Created
November 11, 2014 14:22
-
-
Save barryhughes/5ed4676ce7ebfe30d376 to your computer and use it in GitHub Desktop.
Helper for customizations relying on front page pagination hack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Workaround for themes, plugins and customizations that rely on | |
* redirect_canonical() *not* redirecting when pagination is used | |
* on a static front page. | |
*/ | |
add_action( 'init', 'modify_pro_canonical_filter' ); | |
function modify_pro_canonical_filter() { | |
if ( ! class_exists( 'TribeEventsPro' ) ) return; | |
$pro = TribeEventsPro::instance(); | |
$filter = array( $pro, 'filter_canonical_link_on_recurring_events' ); | |
remove_filter( 'wp', $filter, 10, 1 ); | |
add_filter( 'template_redirect', $filter, 20, 1 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment