- This topic has 0 replies, 1 voice, and was last updated 4 years, 9 months ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- The forum ‘Tips’ is closed to new topics and replies.
Events Made Easy › Forums › Tips › Even Better SEO for Events, Locations
Tagged: canonical on events page, SEO, yoast
There are a couple of posts under “How to make EME and Yoast play nice together?” at https://www.e-dynamics.be/wordpress/faq/ discussing how to make Yoast behave better with the Events page and dynamic events and locations.
I followed the instructions on the FAQs to add dynamic titles, get OG tags, etc but found one more issue: Google wouldn’t crawl the site because Yoast added a page canonical that overrode the dynamic canonical.
So in addition to the suggested code for the functions.php file, I also added the following (found on stack):
add_filter( 'wpseo_canonical', 'yoast_remove_canonical_items' );
function yoast_remove_canonical_items( $canonical ) {
if ( is_page ( 3475 ) ) {
return false;
}
/* Use a second if statement here when needed */
return $canonical; /* Do not remove this line */
}
Any comments to better this are welcomed…