Viewing 3 replies - 1 through 3 (of 3 total)
  • Following this! If you work it out pedronx could you please let me know by replying to this comment. Thanks and good luck!

    Thread Starter pedronx

    (@pedronx)

    Unfortunatly, I don’t find the answer yet. I ask on Yoast forum but they don’t response…
    Regards

    Here is the code that works for me.

    
    /**
     * remove the yoast canonical tag on archive, search and 404 pages.
     */
    add_filter( 'wpseo_canonical', 'wpseo_canonical_exclude' );
    function wpseo_canonical_exclude( $canonical ) {
    	global $post;
    	
    	if( is_search() ){
    		$canonical = false;
    		remove_action('wp_head', 'rel_canonical');
    	}
    	return $canonical;
    }
    
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Remove canonical tag from search results page’ is closed to new replies.