• Resolved ricola771

    (@ricola771)


    Hi,

    This plugin has helped the speed metrics of my site greatly! I have one small issue yet to resolve: It only caches the home page and not any paginations under it. For example, https://example.com/page/2/ will be cached forever and the content will never be updated after adding new posts.

    This has been mentioned before here: https://ww.wp.xz.cn/support/topic/how-to-solve-the-pagination-cache-problem/.
    Such post discusses a workaround adding some code using swcfpc_post_related_url_init.

    Can you please share it? I’m not an experienced coder.

    So far, the only solution I’ve found is to disable the plugin before adding a new post and then enabling it again.

    My settings:
    -I have the homepage to display latest posts.
    -Using theme foodica lite. Can be downloaded at: https://themes.trac.ww.wp.xz.cn/browser/foodica/1.1.1?rev=131332

    Please let me know if you need more information. Thanks a lot for your support and the work behind this plugin!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor iSaumya

    (@isaumya)

    Hi,
    The home page paginations are not considered by the plugin but as you stated you can use the swcfpc_post_related_url_init filter to add extra URLs that will be considered under the list of related URLs.

    For example you can add the following code in your functions.php file:

    add_filter( 'swcfpc_post_related_url_init', function($listofurls) {
    	return array_merge(
    		$listofurls,
    		[
    			'https://example.com/page/2/',
    			'https://example.com/page/3/',
    			'https://example.com/page/4/',
    			'https://example.com/page/5/',
    			'https://example.com/page/6/',
    			'https://example.com/page/7/',
    			'https://example.com/page/8/',
    			'https://example.com/page/9/',
    			'https://example.com/page/10/'
    		]
    	);
    } );

    Make sure you replace the URLs with actual URLs.
    Hope this helps.

    Thread Starter ricola771

    (@ricola771)

    Thank you so much for your help Saumya! Issue has been solved.

    Can this code be future proofed? For instance, adding 50 pages to the code even though I currently have 20? Will this create a problem with the plugin?

    I ask this because once my page is full (12 posts) I will have to add a non existing page to the code before creating a new post.

    Cheers

    Plugin Contributor iSaumya

    (@isaumya)

    Well, I honestly don’t think you will need to add more than 10 pages for pagination. As no real user will go that deep on the pagination. So, if you old pagination pages are not updated, it’s fine.

    Thread Starter ricola771

    (@ricola771)

    Makes sense. Thanks!

    Thread Starter ricola771

    (@ricola771)

    Saumuya, I just noticed that the categories URLS autoupdate but not the tags URLS.

    Is there a way to fix this without adding each tag page to the code above?

    Thanks,

    Plugin Contributor iSaumya

    (@isaumya)

    From what I see in the code, all post taxonomies i.e. both catory and tags should get auto purges as it is considered under related items.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Pagination cache problem’ is closed to new replies.