Skip Navigation

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' );
            

Leave a Reply

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>