• Resolved ravi121923

    (@ravi121923)


    I am using this plugin on my website. I want to disable page caching on specific pages. This feature is enabled from settings, and I can see an option of “Cloudflare page cache settings”.

    The issue is: I cant see this option on custom post type pages when I edit them. is there anything I am missing?

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

    (@isaumya)

    Hi @ravi121923,
    You can add the page paths in the plugin settings to disable caching for those pages. Check under the cache tab.

    Thread Starter ravi121923

    (@ravi121923)

    Hmm that should do the job, but its difficult to goto plugin settings for this task for page specific task. Is there any way I can enable that settings for custom post types? because its available to normal posts, not CPT.

    Thread Starter ravi121923

    (@ravi121923)

    Its working now after enabling from wprocket side. please ignore my previous response. Thank you for the help.

    Thread Starter ravi121923

    (@ravi121923)

    Please ignore my previous message by mistake I sent in this reply. here is my query:

    its difficult to goto plugin settings for this task for page specific task. Is there any way I can enable that settings for custom post types? because its available to normal posts, not CPT.

    Plugin Contributor iSaumya

    (@isaumya)

    Hi @ravi121923,
    Inside the plugin settings > other tab you can also set this settings to NO (https://i.imgur.com/NxPUjXO.jpeg) and this will add a new section for each page where you can select if you would like to bypass it.

    Thread Starter ravi121923

    (@ravi121923)

    I have already set this to NO. But its showing the option to disable cache on specific pages for posts/pages only. not for custom post types. is there anything extra required to get this option in CPT?

    Plugin Contributor iSaumya

    (@isaumya)

    Hi @ravi121923,
    Please download this build of the plugin and upload it to your website.

    Once you have added this new plugin build to your website you can take advantage of a new filter that I’ve just added named swcfpc_bypass_cache_metabox_post_types to add your own CPTs to the allowed list of post types for which the Meta Box will be created (by default it is only created for pages and posts).

    Finally you can use the following code to add the metabox for your CPT:

    add_filter( 'swcfpc_bypass_cache_metabox_post_types', function( $allowed_post_types ) {
    	return [
    		...$allowed_post_types,
    		'my_custom_post_type_name'
    	];
    } );

    Please note that it only accept screen name id. So, you should do a var_dump( get_current_screen() ); first to get the screen id which you need to pass. Read more here: https://developer.www.ads-software.com/reference/functions/add_meta_box/#:~:text=%24-,screen,-string%7Carray

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Disable page caching for specific pages with CPT’ is closed to new replies.