{"id":7884,"date":"2017-08-23T06:00:39","date_gmt":"2017-08-23T10:00:39","guid":{"rendered":"https:\/\/blog.litespeedtech.com\/?p=7884"},"modified":"2017-08-23T06:00:39","modified_gmt":"2017-08-23T10:00:39","slug":"wpw-litespeed-cache-post-types-and-taxonomies","status":"publish","type":"post","link":"https:\/\/lswp.store\/index.php\/2017\/08\/23\/wpw-litespeed-cache-post-types-and-taxonomies\/","title":{"rendered":"WpW: LiteSpeed Cache, Post Types and Taxonomies"},"content":{"rendered":"<p><img fetchpriority=\"high\" decoding=\"async\" title=\"\" src=\"https:\/\/lswp.store\/wp-content\/uploads\/2017\/08\/null-2.jpeg\" alt=\"\" width=\"640\" height=\"320\" \/><\/p>\n<p>Welcome to another installment of <a href=\"http:\/\/blog.litespeedtech.com\/tag\/wordpress-wednesday\">WordPress Wednesday<\/a>!<\/p>\n<p>Last week we <a href=\"https:\/\/lswp.store\/2017\/08\/16\/wpw-understanding-custom-post-types-and-taxonomies\/\">explored the often misunderstood concepts of Post Types and Taxonomies<\/a> in WordPress. This week, we are going to relate that to our LiteSpeed Cache plugin. How does LSCWP handle Post Types and Taxonomies, both the built-in kinds and the custom ones? .<\/p>\n<p>You know from <a href=\"https:\/\/lswp.store\/2017\/08\/16\/wpw-understanding-custom-post-types-and-taxonomies\/\">our last article<\/a> that WordPress consists of seven post types and four taxonomies by default (as of this writing), plus any custom post types and taxonomies you or your plugins may have added.<\/p>\n<p><b>LiteSpeed Cache for WordPress caches all post types and post-related taxonomies, even custom ones.<\/b><\/p>\n<p>Additionally, when it comes to <i>managing <\/i>the cache, there are a few places where post type and taxonomy come into play.<\/p>\n<h2>Purging by Taxonomy<\/h2>\n<p>You can purge two built-in taxonomies from the cache on demand: category and tag.<\/p>\n<p>From your WordPress dashboard, navigate to <b>LiteSpeed Cache &gt; Manage<\/b>, scroll down to <b>Purge By\u2026<\/b> and select either <code>Category<\/code> or <code>Tag<\/code>. Enter the name(s) of the category or tag that you wish to purge.<\/p>\n<p>It is not currently possible to manually purge any taxonomies other than category or tag from the cache.<\/p>\n<h2>Auto Purging<\/h2>\n<p>One of LSCache\u2019s most powerful features is its ability to auto-purge certain pages based on a set of rules. These rules say: \u201cwhen a post is updated or published, purge these other pages that are related to the post.\u201d<\/p>\n<p><img decoding=\"async\" title=\"\" src=\"https:\/\/lswp.store\/wp-content\/uploads\/2017\/08\/null-1.png\" alt=\"\" width=\"672\" height=\"637\" \/><\/p>\n<p>See the <code>Post type archive<\/code> and <code>Term archive<\/code> options up there? If you select those, then your custom post types and your custom taxonomies will be included in an automatic purge.<\/p>\n<p>Remember last week\u2019s example? We put our discussion of custom post types and taxonomies in the context of your fictitious automotive review site. We said that you had a custom post type \u201cReview\u201d and custom taxonomies \u201cModel Year,\u201d \u201cMake\u201d and \u201cModel.\u201d<\/p>\n<p>Continuing with that example, if you were to update your review of the 2013 Chevy Impala, then that post would be purged, along with the post type archive (review), and the taxonomy\/term archives (2013, chevrolet, and impala). To access these settings, from your WordPress dashboard, navigate to <b>LiteSpeed Cache &gt; Settings &gt; Purge Rules<\/b>.<\/p>\n<h2>Do Not Cache Rules for Custom Post Types and Taxonomies<\/h2>\n<p>If you have post types that you <i>do not<\/i> want to be cached, you can define rules to exclude them. From your WordPress dashboard, navigate to <b>LiteSpeed Cache &gt; Settings &gt; Do Not Cache Rules<\/b>.<\/p>\n<p>You can exclude particular categories by listing the relevant category IDs in the <b>Category List<\/b> box.<\/p>\n<p>You can exclude particular tags by listing the relevant tag IDs in the <b>Tag List<\/b> box.<\/p>\n<p>You can exclude custom taxonomies (and post types) as well, if your permalink structure supports it, but it\u2019s not quite as simple. You need to use the <b>URI List<\/b>. To determine what to enter in the box, you\u2019ll have to look at the structure of your permalinks. Let\u2019s say your permalinks are in this format:<\/p>\n<pre>\nhttp:\/\/www.yourdomain.com\/custom-post-type\/custom-taxonomy\/term\/post-title\n<\/pre>\n<p>for example:<\/p>\n<pre>\nhttp:\/\/www.yourautoreviewsite.com\/reviews\/makes\/chevrolet\/reviewing-2013-chevy-impala\n<\/pre>\n<p>If you wanted to exclude all of your reviews from being cached, you\u2019d enter <code>\/reviews\/<\/code> in the <b>URI List<\/b>.<\/p>\n<p>If you only wanted to exclude reviews of Chevrolets, then you\u2019d enter <code>\/reviews\/makes\/chevrolet\/<\/code> in the <b>URI List<\/b>.<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" title=\"\" src=\"https:\/\/lswp.store\/wp-content\/uploads\/2017\/08\/null-2.png\" alt=\"\" width=\"622\" height=\"458\" \/><\/p>\n<p><b>URI List<\/b> does a prefix match to relative links, meaning it matches whatever strings you enter to the beginning of the URLs (minus the domain names).<\/p>\n<p>So, using the example URL above, if you enter <code>\/reviews\/makes\/chevrolet\/<\/code> it will match <code>\/reviews\/makes\/chevrolet\/reviewing-2013-chevy-impala<\/code>, and <code>\/reviews\/makes\/chevrolet\/reviewing-2006-chevy-uplander<\/code> but not <code>\/reviews\/makes\/pontiac\/reviewing-2006-pontiac-montana<\/code>.<\/p>\n<p>Your permalinks may be set up differently than this, but hopefully there is <i>something<\/i> about them that can differentiate them enough from your other content. Use that difference to single out a prefix for the <b>URI List<\/b> box.<\/p>\n<h2>Crawling<\/h2>\n<p>If the crawler is enabled on your site, then your custom post types are already included in the crawl. You can exclude them, if you like.<\/p>\n<p>From the WordPress dashboard, navigate to <b>LiteSpeed Cache &gt; Settings &gt; Crawler<\/b>. Under the <b>Exclude Custom Post Types<\/b> input box, you will see a list of available custom post types. Enter the ones you want to exclude, one line at a time, and they will not be crawled.<\/p>\n<p>And there you have it. LiteSpeed Cache for WordPress caches all built-in and custom post types, which is great news! And for those special cases, where you don\u2019t want certain post types to be cached, LSCWP provides mechanisms that allow you to manage those cases. Be sure to leave a comment if you have any questions about this topic!<\/p>\n<p>&#8212;<\/p>\n<p>Have some of your own ideas for future <a href=\"http:\/\/blog.litespeedtech.com\/tag\/wordpress-wednesday\">WordPress Wednesday<\/a> topics? Leave us a comment!<\/p>\n<p>Don\u2019t forget to meet us back here next week for the next installment. In the meantime, here are a few other things you can do:<\/p>\n<ul>\n<li>Subscribe to the <a href=\"http:\/\/blog.litespeedtech.com\/tag\/wordpress-wednesday\/feed\/\">WordPress Wednesday RSS feed<\/a><\/li>\n<li>Download <a href=\"https:\/\/wordpress.org\/plugins\/litespeed-cache\/\">LiteSpeed Cache for WordPress plugin<\/a><\/li>\n<li>Learn more about the plugin <a href=\"https:\/\/www.litespeedtech.com\/products\/cache-plugins\/wordpress-acceleration\">on our website<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Does LiteSpeed Cache handle all built-in and custom post types and taxonomies?<\/p>\n","protected":false},"author":1,"featured_media":8132,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[28],"tags":[316,317],"class_list":["post-7884","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cache","tag-wordpress","tag-wordpress-wednesday"],"jetpack_featured_media_url":"https:\/\/lswp.store\/wp-content\/uploads\/2017\/09\/wpw15.jpg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts\/7884","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/comments?post=7884"}],"version-history":[{"count":0,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts\/7884\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/media\/8132"}],"wp:attachment":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/media?parent=7884"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/categories?post=7884"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/tags?post=7884"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}