Created
April 16, 2018 15:28
-
-
Save sybrew/a3f8f37fc789eb920de83e61782fde26 to your computer and use it in GitHub Desktop.
Disable TSF when request URL starts with any of the exclusions.
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 | |
//* Don't include the PHP tag. | |
add_action( 'after_setup_theme', function() { | |
$exclusions = array( | |
'/sample-page', | |
'/forums', | |
'/replies', | |
); | |
$tsf = function_exists( 'the_seo_framework' ) ? the_seo_framework() ?: null : null; | |
if ( ! isset( $tsf, $_SERVER['REQUEST_URI'] ) ) return; | |
foreach ( $exclusions as $exclusion ) { | |
if ( 0 === strpos( $_SERVER['REQUEST_URI'], $exclusion ) ) { | |
remove_action( 'init', array( $tsf, 'init_the_seo_framework' ), 0 ); | |
break; | |
} | |
} | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment