WpW: LiteSpeed Cache, Post Types and Taxonomies

August 23rd, 2017 by LSCache 0 Comments

Welcome to another installment of WordPress Wednesday!

Last week we explored the often misunderstood concepts of Post Types and Taxonomies 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? .

You know from our last article 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.

LiteSpeed Cache for WordPress caches all post types and post-related taxonomies, even custom ones.

Additionally, when it comes to managing the cache, there are a few places where post type and taxonomy come into play.

Purging by Taxonomy

You can purge two built-in taxonomies from the cache on demand: category and tag.

From your WordPress dashboard, navigate to LiteSpeed Cache > Manage, scroll down to Purge By… and select either Category or Tag. Enter the name(s) of the category or tag that you wish to purge.

It is not currently possible to manually purge any taxonomies other than category or tag from the cache.

Auto Purging

One of LSCache’s most powerful features is its ability to auto-purge certain pages based on a set of rules. These rules say: “when a post is updated or published, purge these other pages that are related to the post.”

See the Post type archive and Term archive options up there? If you select those, then your custom post types and your custom taxonomies will be included in an automatic purge.

Remember last week’s 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 “Review” and custom taxonomies “Model Year,” “Make” and “Model.”

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 LiteSpeed Cache > Settings > Purge Rules.

Do Not Cache Rules for Custom Post Types and Taxonomies

If you have post types that you do not want to be cached, you can define rules to exclude them. From your WordPress dashboard, navigate to LiteSpeed Cache > Settings > Do Not Cache Rules.

You can exclude particular categories by listing the relevant category IDs in the Category List box.

You can exclude particular tags by listing the relevant tag IDs in the Tag List box.

You can exclude custom taxonomies (and post types) as well, if your permalink structure supports it, but it’s not quite as simple. You need to use the URI List. To determine what to enter in the box, you’ll have to look at the structure of your permalinks. Let’s say your permalinks are in this format:

http://www.yourdomain.com/custom-post-type/custom-taxonomy/term/post-title

for example:

http://www.yourautoreviewsite.com/reviews/makes/chevrolet/reviewing-2013-chevy-impala

If you wanted to exclude all of your reviews from being cached, you’d enter /reviews/ in the URI List.

If you only wanted to exclude reviews of Chevrolets, then you’d enter /reviews/makes/chevrolet/ in the URI List.

URI List does a prefix match to relative links, meaning it matches whatever strings you enter to the beginning of the URLs (minus the domain names).

So, using the example URL above, if you enter /reviews/makes/chevrolet/ it will match /reviews/makes/chevrolet/reviewing-2013-chevy-impala, and /reviews/makes/chevrolet/reviewing-2006-chevy-uplander but not /reviews/makes/pontiac/reviewing-2006-pontiac-montana.

Your permalinks may be set up differently than this, but hopefully there is something about them that can differentiate them enough from your other content. Use that difference to single out a prefix for the URI List box.

Crawling

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.

From the WordPress dashboard, navigate to LiteSpeed Cache > Settings > Crawler. Under the Exclude Custom Post Types 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.

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’t 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!

Have some of your own ideas for future WordPress Wednesday topics? Leave us a comment!

Don’t forget to meet us back here next week for the next installment. In the meantime, here are a few other things you can do:


Categories:LSCache

Related Posts


Comments