Pular navegação

Waiting for author

Overview of the issue

When using the WP Residence theme, using a language switcher in the main top menu results in incorrect URLs. This issue is caused by the theme’s custom menu caching mechanism using transients, which caches the language switcher links.

Workaround

Please, make sure of having a full site backup of your site before proceeding.

  • Add the following code in your functions.php file:
    /**
     * Zap every WP Residence menu transient, on each page load.
     * The target string is unique enough that a single LIKE works.
     */
    function cleanup_wpresidence_menu_transients() {
    	global $wpdb;
    
    	$like = '%' . $wpdb->esc_like( 'wpestate_wpresidence_primary_menu_complete' ) . '%';
    
    	$wpdb->query(
    		$wpdb->prepare(
    			"DELETE FROM {$wpdb->options}
    			 WHERE option_name LIKE %s",
    			$like
    		)
    	);
    }
    add_action( 'init', 'cleanup_wpresidence_menu_transients' );
            

Deixe uma resposta

Por favor, mantenha-se no assunto e seja respeitoso com os outros. Se precisar de ajuda com questões não relacionadas a este post, use nosso Fórum de Suporte para iniciar um chat ou enviar um ticket.

Você pode usar estas tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>