Skip to content

Instantly share code, notes, and snippets.

@sybrew
Created April 16, 2018 15:28
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 sybrew/a3f8f37fc789eb920de83e61782fde26 to your computer and use it in GitHub Desktop.
Save sybrew/a3f8f37fc789eb920de83e61782fde26 to your computer and use it in GitHub Desktop.
Disable TSF when request URL starts with any of the exclusions.
<?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