Exclude by URL
-
Hello,
I’m using a third party plugin to create set of posts in WordPress that doesn’t utilize custom post types.
I want to exclude all child post (/abc/xyz/) titles and metas NOT to be rewritten by The SEO Framework except for the parent page (/abc/).
I found this code snippet somewhere that excludes child posts correctly but also for the parent page (/abc/).
As I’m not much of an coder can someone help me to modify this code so that ONLY child posts of /abc/ would be excluded?
add_action( 'after_setup_theme', function() { $exclusions = array( '/abc/', ); $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; } } } );
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Exclude by URL’ is closed to new replies.