Support » Plugin: Permalink Manager Lite » Unable to change Canonical link

  • Resolved imemine

    (@imemine)


    Hello,

    Great plugin.

    We use it together with Newspaper theme, but using Yoast SEO Canonical option, it won’t reflect the updated canonical link.

    This is the function the theme people use.
    $td_current_page = '<link rel="canonical" href="' . get_pagenum_link($paged) . '"/>';

    It works properly if I disable this plugin. Any clue?

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Maciej Bis

    (@mbis)

    Hi @imemine,

    I changed canonical URL in Yoast SEO metabox and it did not change the output of get_pagenum_link() function.

    Could you send me two screenshots with HTML output of canonical tag with and without my plugin activated?

    Best regards,
    Maciej

    Plugin Author Maciej Bis

    (@mbis)

    Hi again @imemine,

    Just wanted to check in to see if you managed to get it working.

    If you have not solved your problem – feel free to reopen it and provide additional details on your problem, if any.

    Best regards,
    Maciej

    Thread Starter imemine

    (@imemine)

    Hello @mbis Thanks for checking back.

    Unfortunately it didn’t work, so we made a custom box to add a canonical.

    We are unable to remove the one generated though, so there are two now.

    Are these we should be removing?

    add_action( ‘template_redirect’, array($this, ‘new_uri_redirect_and_404’), 1);
    add_action( ‘wp’, array($this, ‘adjust_canonical_redirect’), 0, 1);

    Can you please suggest the edits required?

    Thank you

    Plugin Author Maciej Bis

    (@mbis)

    Hi @imemine,

    The two mentioned hooks are related to other functionalities. If you would like to disable the hooks that overwrite Yoast SEO canonical meta tags, you will need to use below code:

    function pm_unhook_yoast_filters() {
    	global $permalink_manager;
    
    	if(!empty($permalink_manager) && property_exists($permalink_manager, 'functions')) {
    		remove_filter('wpseo_canonical', array($permalink_manager->functions['third-parties'], 'yoast_fix_canonical'), 10);
    		remove_filter('wpseo_opengraph_url', array($permalink_manager->functions['third-parties'], 'yoast_fix_canonical'), 10);
    	}
    }
    add_action('wp_loaded', 'pm_unhook_yoast_filters');

    Best regards,
    Maciej

    Thread Starter imemine

    (@imemine)

    Thank you so much.

    It works great.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Unable to change Canonical link’ is closed to new replies.