Forums Forums Search & Filter Pro Exclude Category from cache

Viewing 10 posts - 1 through 10 (of 10 total)
  • Anonymous
    #85510

    Hi

    I’ve got a website of around 4000 posts (each using Advanced Custom Fields), and the caching is taking a long time (there are around 500 categories (not all in use), and 300 tags). It also uses Advanced Custom Fields.

    However only around 1000 posts actually appear on the website (the rest are in a category called Expired and don’t actually appear on the website so don’t need to be cached) – so would it be possible to

    A) Exclude all posts in that category from caching, as it’s really slowing the website down
    B) I’m not sure if the plugin caches this data, but can it be adjusted to only cache the Category and Tags data for each post, but not to worry about the custom fields etc?

    Essentially I’m looking for any way which would help speed up the caching by only getting it to cache the sections of the website I need it to search?

    Thank you in advance

    Joey

    Ross Moderator
    #85531

    Hey Joey

    Have you updated the plugin to the latest version?

    2.3 had some huge speed improvements especially in terms of the speed of admin.

    Just as an FYI, S&F caches all taxonomies of the post types you’ve selected and only the post meta if they are actually added as fields in the search form.

    That being said, it would still be a good idea to give users’ control over what is cached for circumstances like this, let me think on this, it might not be too hard to add in a filter that gives you access to the query that is used to create the cache in the first place.

    Thanks

    Anonymous
    #85535

    Thanks for the speedy reply Ross ๐Ÿ™‚

    I’ve just installed the latest version which was downloaded today, but it still took quite a while to process, during which I couldn’t access the rest of the admin – and the front end speed slowed right down as well.

    I’m happy to hard code a temporary fix (if you let me know what code to put where?!)

    Thanks for your help

    Ross Moderator
    #85541

    Hi Joey

    Just a quick one, you’re not constantly rebuilding the cache are you?

    Once its built once, you can leave it alone. Any new posts created / edited will be updated automatically without any need to fiddle with the cache?

    Thanks

    Anonymous
    #85586

    Thanks Ross – I’m not sure if it was crashing, but it seemed to keep trying to rebuild the cache again each time I edited the search form?

    I have a feeling it will slow down the site considerably, as the website is constantly getting updated with new posts, as well as editing the existing ones to keep the data fresh.

    At the moment I’m on shared hosting – would you recommend upgrading this to something more powerful (I presume this would speed up the cache building) for this size of website?

    Thanks in advance

    Ross Moderator
    #85672

    Hi Joey, the cache will be rebuilt whenever you change the following in your search form:

    1) When you add and remove post meta/custom fields from your search form (all other fields can be added/removed without triggering the rebuild)
    2) When you change the post types
    3) When you change the post status’ in the posts tab of your search form

    So as long as you’ve setup your search form and are happy with it, you won’t need to rebuild and it shouldn’t be triggered – I’m assuming you don’t have a need to keep changing your search form, only initially while setting up and testing? If you do have a need, let me know, maybe there is a better way to do what you are doing without having to trigger rebuilding of cache so often.

    While its rebuilding, it will likely slow the site down, but once its done, it should be pretty much transparent when you are using the site.

    Around 4k posts is getting near the limits of shared I think so of course a better server will mean better performance.

    A few things you should be doing to keep your site running fast as you increase the number of posts:

    1) Use a caching plugin (of course this is not S&F related)

    Do you notice slowdown on the frontend of your site (only test this when S&F caching has finished building) throughout your site? Then:

    2) Is your search form present on many pages of your site (like a sidebar?) and this seems to be causing a slowdown? If so enable “transients” option in S&F settings (in the main admin menu), this will make the search form load lightning fast on “non” search results pages (ie, the other pages in your site) – wait for caching to finish before testing this out.

    3) Do the search results take a long time to load when a user interacts with the search form? There is not much that can be done about this, and its where your hosting will come into play (we continue to make speed optimisations where possible).

    However, there is one setting which add significant overhead to all searches – in the general tab you will find “auto count” – disabling this (if enabled) should allow you to search a lot more posts are better speeds, however, this is a really popular feature and is essential for some setups.

    RE the info about modifying the cache, if you goto -> search-filter-pro\includes\class-search-filter-post-cache.php and head to line 332 you will find the WP_Query that is performed to build the list of posts to cache, you can edit the args above to filter out certain taxonomies etc ๐Ÿ™‚

    This only applies to the big rebuild queue that happens when you change the search form itself, the automatic caching the occurs whenever a post is updated will not be affected.

    Thanks

    Anonymous
    #85706

    Thank you for your detailed reply Ross I really appreciate it.

    Regarding Caching the front end – yes this is completed via WP Fastest Cache – I found this to be the fastest for my needs

    Regarding the code changes:

    I tried adding

    
                $query_args = array(
        'category__not_in' => array( 283 )
      );
    

    Directly above that line 332 in search-filter-pro\includes\class-search-filter-post-cache.php but it doesn’t seem to build the cache (it says “Caching paused: attempting to resume… ” whilst attempting to build cache of just 60 posts)

    I don’t suppose you know the code to add to get it working? Many thanks in advance

    Ross Moderator
    #85733

    Hey Joey

    If you enable WP_DEBUG, and logging then you can check the file that is created to see where your error is coming from – its probably a PHP error in your code.

    Anyway, if you remove what you have done, and instead, on line 332 put the following (directly above the WP_Query line, moving that one down a line):

    $query_args['category__not_in'] = array( 283 );

    That looks like its correct.

    Thanks

    Anonymous
    #85745

    Thank you so much for this – all working so far! Is it ok to keep this topic open as I’m currently checking with the hosting company to see what the most suitable package upgrade will be?

    Thanks again ๐Ÿ™‚

    Ross Moderator
    #85832

    I would wait until that cache has built 100% in the admin, then take the steps above, and do some real testing to see if the speeds are ok, I think they would be, but if you add more and more posts, it might start slowing down.

    Make sure to turn on the transient feature too, after the first load the Search Form should load lightning fast.

    RE the hosting, I couldn’t really say, each are so different and even a list of specs (which is hard to get from most hosts) wouldn’t prove anything. I would just upgrade incrementally until you are happy with the speeds.

    Best

Viewing 10 posts - 1 through 10 (of 10 total)