Skip to content

Instantly share code, notes, and snippets.

@GeoffEW
Created October 28, 2016 22:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GeoffEW/ad2d0879e2daec631074e2e15c0a9852 to your computer and use it in GitHub Desktop.
Save GeoffEW/ad2d0879e2daec631074e2e15c0a9852 to your computer and use it in GitHub Desktop.
Allows mobile view default setting to work alongside Yoast SEO
<?php add_filter( 'wpseo_canonical', function( $canonical_url ) {
global $wp_query;
return ! empty( $wp_query->tribe_is_event_query ) && wp_is_mobile()
? Tribe__Events__Main::instance()->getLink( tribe_get_mobile_default_view() )
: $canonical_url;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment