탐색 건너뛰기

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

답장을 남겨주세요

주제를 유지하고 다른 사람을 존중하십시오. 이 게시물과 관련 없는 문제에 대한 도움이 필요한 경우 지원 포럼을 사용하여 채팅을 시작하거나 티켓을 제출하십시오.

다음 태그를 사용할 수 있습니다.
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>