Support » Plugin: Yoast SEO » PHP Error after update

  • Resolved Ivijan-Stefan Stipic

    (@ivijanstefan)


    Hi, my error log start to bi filled with this error after latest update!

    [31-Jul-2020 10:02:24 UTC] PHP Warning: You cannot overrule a WPSEO standard variable replacement by registering a variable with the same name. Use the "wpseo_replacements" filter instead to adjust the replacement value. in /public_html/wp-content/plugins/wordpress-seo/inc/class-wpseo-replace-vars.php on line 136

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Support Maybellyne

    (@maybellyne)

    Hello Ivijan-Stefan,

    Thanks for reaching out!

    Looking at the error details, this may happen when the plugin files are cached and some old files are still used after updating the plugin. Sometimes, it causes temporary errors that resolve themselves once the cache has been cleared.

    If the problem doesn’t resolve for you automatically, can you please try clearing the cache from your theme, plugin, server and CDN (e.g. CloudFlare) before and after updating Yoast SEO? If you are not sure how to clear the cache from a theme or plugin please speak to those authors. If you want to clear cache from the server, please speak to your host provider.

    Thank you.

    • This reply was modified 6 months ago by Maybellyne.

    I don’t think it’s relevant to cash.

    I tried everything and nothing has changed. I’m a PHP developer too but I haven’t seen a problem like this before.

    Should I try to download the plugin manually and replace the files on the server?

    Plugin Support devnihil

    (@devnihil)

    @ivijanstefan If the error occurred immediately following an update it’s possible that something went wrong during the update that caused the plugin’s files to become incomplete or damaged. Can you please try performing a manual update of the plugin and see whether this resolves the error? We have instructions on how to upgrade the plugin manually at the following link: https://kb.yoast.com/kb/how-can-i-update-my-free-plugin/#ftp. You will need an FTP program such as FileZilla and your FTP details, which can be obtained from your host provider.

    I am programmer last 17 years, I know how to use FTP.

    I did a manual update and problem still exists. I don’t use cache plugins, I reset all possible caches I knew, restarted the server, I use PHP 7.3 and I still have the same problem.

    My error log is 2GB for the last 3 days. All I have to do is remove Yoast SEO and move to some other solution.

    Or you have some another idea?

    Plugin Support Pcosta88

    (@pcosta88)

    Hi,

    From what we can gather, it seems to be an error Yoast tosses out when you have custom template variables that is the same name as the default ones Yoast/WordPress uses.

    We would like some more information.

    1. Can you confirm you are using WordPress 5.4.2? You can check by clicking on the W in the top left and selecting About. If you need to update, please check with your host provider. Please know that if you are using an older version of WordPress Core you may experience unexpected behavior with Yoast. This guide explains more: https://yoast.com/why-we-dont-support-old-wordpress-versions/.

    2. Are all your non-Yoast plugins and themes also updated?

    3. To clarify, you are on, v14.6.1 of Yoast SEO Premium?

    4. Did you create or are using any kind of custom template variable to try to output data such as in the title or meta description fields? For example, if you go to SEO-Search Appearance and click around at the different tabs and click on the different items that appear and look at the purple circles (what we call template variables) are any of those using the defaults? You can learn more about the default template variables here: https://yoast.com/help/list-available-snippet-variables-yoast-seo/#default-variables

    You are right. I just find what is happening.

    I have one part of code where I create new Yoast SEO variables using wpseo_register_var_replacement() to add geo information inside your plugin. This is old code what is added last year and I forgot on it.

    if ( is_plugin_active( 'wordpress-seo/wp-seo.php' ) || is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' ) ) {
    	add_action('wpseo_register_extra_replacements', 'wpseo_register_extra_replacements', 99);
    }
    function wpseo_register_extra_replacements(){
    	
    	if(!function_exists('wpseo_register_var_replacement'))
    	{
    		if(file_exists(dirname(CFGP_ROOT).'/wordpress-seo/inc/class-wpseo-replace-vars.php'))
    		{
    			include_once(dirname(CFGP_ROOT).'/wordpress-seo/inc/class-wpseo-replace-vars.php');
    		}
    		else if(file_exists(dirname(CFGP_ROOT).'/wordpress-seo-premium/inc/class-wpseo-replace-vars.php'))
    		{
    			include_once(dirname(CFGP_ROOT).'/wordpress-seo-premium/inc/class-wpseo-replace-vars.php');
    		}
    		else return;
    	}
    	
    	if(!function_exists('wpseo_register_var_replacement')) return;
    	
    	$CFGEO = $GLOBALS['CFGEO'];
    	if(is_array($CFGEO))
    	{
    		$collection = array();
    		
    		foreach($CFGEO as $key => $val){
    			wpseo_register_var_replacement( '%%' . $key . '%%', function() use ($val){
    				return $val;
    			}, 'advanced', $key );
    		};		
    	}
    }

    Please tell me, does this mean that my code has a variable that has the same name as your registered variable?

    Thanks!

    Plugin Support Michael Tina

    (@mikes41720)

    Hi,

    Thank you for your response. Based on your custom code, it looks like we’ll have to investigate this further to confirm.

    Could you confirm you have an active Yoast SEO Premium subscription? If so, please feel free to contact us directly in order to avail of our premium support and reference this forum thread as well — https://yoast.com/help/support/#premium

    I don’t have a premium yet.

    I had it a couple of years ago, now I only use the free version.

    Thanks!

    Plugin Support Jeroen Rotty

    (@jeroenrotty)

    Hi @ivijanstefan,

    As much as we hate to say it, your question goes beyond the technical expertise of me and my colleagues on the Yoast support team. This means we can’t give you a solid answer to your question.

    But we don’t want to leave you empty-handed either, that’s why we’ve created our developer portal at developer.yoast.com. This has proven to be useful to many developers in the past, and hopefully will serve you well too.

    Sorry we can’t be of more help on your custom code.

    Everything is clear to me, don’t worry.

    This was helpful because now I know where the mistake is and what I need to do. I reviewed your algorithm and found a solution.

    Thanks a lot!

    Plugin Support Jeroen Rotty

    (@jeroenrotty)

    Awesome, thank you for letting us know.

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