Support » Plugin: Yoast SEO » WP super cache and Yoast SEO incompatible

  • Hi Team, I started facing some issues with the WP Super cache plugin when Yoast is active. When Yoast SEO is active, the cache gets cleared very often. If the plugin is inactive everything is normal. The cache obeys the timeout setting I have set. I tried disabling all other plugins. The only time the cache works is when I deactivate the Yoast plugin.

    Can you help me to fix this issue?


    The page I need help with: [log in to see the link]

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Support Michael Tina


    Hi @praderj

    We aren’t familiar with this issue with the Yoast SEO and WP Super Cache plugins.

    Often, we see problems occur in combination with another plugin or theme. The fastest way to rule out any conflict, is to deactivate all non-Yoast plugins and switch to a standard theme like Twenty Twenty.

    Please test this on your development or staging site, if you have one. If not, we recommend using the Health Check & Troubleshooting plugin. This plugin has a troubleshooting mode, which does not affect normal visitors to your site.

    If you’re unfamiliar with checking for conflicts, we’d like to point you to a step-by-step guide that will walk you through the process: How to check for plugin conflicts

    Could you check if this still occurs with a default WP theme and only those 2 plugins activated?

    Could you also provide us with more specific steps in order to reproduce the issue?

    I’ve experienced the same issue here on one site, thought it was a very rare edge case but it might be similar. It would cache the page fine but clear it a second later, I managed to trace it down to the company logo in the Yoast SEO settings.

    If you have an image in the organization logo section under the Search Appearance > General tab, can you see if removing it stops the cache being cleared prematurely?

    Plugin Support devnihil


    @antonynz Thanks for sharing your solution. @praderj Can you please let us know whether this solution resolves the issue for you?

    Thread Starter Pradeep Augustine


    @antonynz, you are awesome! Thanks for the solution. It works!!

    I was banging my head around for weeks to fix this issue. Thanks again.

    @devnihil, the solution works. Can you guys look into it and fix it in the plugin so that the cache doesn’t clear even with the organization image.


    @praderj glad that fixed it! It should work as expected if a new image is uploaded and added.

    It seems to only occur in rare cases in certain circumstances as I’ve only seen it happen on one site.

    I’ll do some further debugging to see if I can replicate the issue again. From memory it happens when Yoast is having trouble getting the meta details for that image in the media library.

    Plugin Support Michael Tina



    Removing the organization logo from the Search Appearance section might not be the best workaround, because you’d need to set a logo in order for the Yoast SEO schema graph output correctly.

    Could you provide us with the exact steps to try and reproduce the issue from our end? Is it just to enable Yoast SEO 18.9 and WP Super Cache and a default WP theme, and set a logo?

    I have done some digging as to what might have happened:

    The cache clearing is initiated by Yoast in the wordpress-seo/inc/class-wpseo-utils.php file, while it’s creating the schema, and occurs when the company_logo_id in the Yoast settings is “0”. This results in the cache being cleared on most page visits when the page schema is generated.

    I see there’s fallback code that tries to retrieves an ID based off the image attachment URL, if the image_id isn’t set:

    $image_id = WPSEO_Options::get( $setting . '_id', false );
    		if ( ! $image_id ) {
    			$image = WPSEO_Options::get( $setting, false );
    			if ( $image ) {
    				// There is not an option to put a URL in an image field in the settings anymore, only to upload it through the media manager.
    				// This means an attachment always exists, so doing this is only needed once.
    				$image_id = self::get_attachment_by_url( $image );
    				WPSEO_Options::set( $setting . '_id', $image_id );

    In this case the image had been cropped in the media library and I’m taking a guess the custom get_attachment_by_url function couldn’t find the image ID based off the old URL. Although the original image was still in the uploads folder. Re-adding the image loaded the new cropped version and the correct ID was added.

    Unfortunately I can’t replicate the ID being set to 0 on a test site, with a cropped image. Perhaps the ID was added and set to 0 on an older Yoast version, or something else generates that ID after the image has been added?

    It sounds like the OP had a similar issue, since removing the old image fixed the issue.

    Here is a backtrace if it helps:

    wp_cache_clear_cache() ../wordpress-seo/inc/class-wpseo-utils.php:441
    clear_cache() ../wp-includes/class-wp-hook.php:305
    apply_filters() ../wp-includes/class-wp-hook.php:327
    do_action() ../wp-includes/plugin.php:470
    do_action() ../wp-includes/option.php:521
    update_option() ../wordpress-seo/inc/options/class-wpseo-options.php:507
    save_option() ../wordpress-seo/inc/options/class-wpseo-options.php:311
    set() ../wordpress-seo/inc/class-wpseo-image-utils.php:459
    get_attachment_id_from_settings() ../wordpress-seo/src/helpers/image-helper.php:331
    get_attachment_id_from_settings() ../wordpress-seo/src/context/meta-tags-context.php:318
    generate_company_logo_id() ../wordpress-seo/src/presentations/abstract-presentation.php:64
    Plugin Support Michael Tina


    Hi @antonynz

    Thanks for providing this information!

    Regarding this conflict with Yoast SEO and WP Super Cache constantly clearing the cache, the fix/workaround would be to remove the image set as the logo for the organization in the Search Appearance section of the Yoast SEO settings and re-add it?

    @mikes41720 Yes removing and adding the image again seems to pull the correct media ID and stops Yoast saving the options on each view causing the cache to flush.

    Plugin Support Michael Tina


    Hi @antonynz

    Thanks for confirming and for providing this very helpful information.

    Hi @praderj

    if you’ve removed the organization logo, and then re-added it in the Search Appearance section after, could you please check and confirm if the constant cache clearing still occurs or if it’s already resolved?

    Plugin Support devnihil


    We are going ahead and marking this issue as resolved due to inactivity. If you require any further assistance please create a new issue.

    Hi @devnihil just ran into this exact problem ourselves and I can confirm, removing the logo image in Yoast > Search Appearance, then replacing it with the exact same image caused the overly frequent cache clearing to go away. Hope that is helpful.

Viewing 12 replies - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.