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
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
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
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