0, 'order' => 'ASC' ); $cats = get_categories( $args ); $alt = 0; foreach( $cats as $cat ) { ?> >
cat_name; //. ' (' . $cat->cat_ID . ')'; ?> cat_ID, $options['exclude_main'] ) ) { echo 'checked="true" '; } ?>/> cat_ID, $options['exclude_feed'] ) ) { echo 'checked="true" '; } ?>/> cat_ID, $options['exclude_archives'] ) ) { echo 'checked="true" '; } ?>/> cat_ID, $options['exclude_search'] ) ) { echo 'checked="true" '; } ?>/>

Support\n"; echo "

Please report this information when requesting support.

"; echo '"; } function ksuce_process() { //echo '
'; print_r( $_POST );
	if( !isset( $_POST[ 'exclude_main' ] ) )     { $_POST[ 'exclude_main' ] = array(); }
	if( !isset( $_POST[ 'exclude_feed' ] ) )     { $_POST[ 'exclude_feed' ] = array(); }
	if( !isset( $_POST[ 'exclude_archives' ] ) ) { $_POST[ 'exclude_archives' ] = array(); }
	if( !isset( $_POST[ 'exclude_search' ] ) )   { $_POST[ 'exclude_search' ] = array(); }
	$options['exclude_main'] = $_POST[ 'exclude_main' ];
	$options['exclude_feed'] = $_POST[ 'exclude_feed' ];
	$options['exclude_archives'] = $_POST[ 'exclude_archives' ];
	$options['exclude_search'] = $_POST[ 'exclude_search' ];
	update_option( 'ksuceExcludes', $options );
	$message = "

" . ( __( 'Excludes successfully updated', 'UCE' ) ) . "

"; return $message; } function ksuce_get_options(){ $defaults = array(); $defaults['exclude_main'] = array(); $defaults['exclude_feed'] = array(); $defaults['exclude_archives'] = array(); $defaults['exclude_search'] = array(); $options = get_option( 'ksuceExcludes' ); if ( !is_array( $options ) ){ $options = $defaults; update_option( 'ksuceExcludes', $options ); } return $options; } function ksuce_exclude_categories( $query ) { $backtrace = debug_backtrace(); $array2[0] = ""; unset( $array2[0] ); $options = ksuce_get_options(); //wp_reset_query(); //error_log( print_r( debug_backtrace(), true ) ); //error_log( 'search for match: ' . in_array_recursive( 'WPSEO_Video_Sitemap', $backtrace ) ); //Exclude calls from the Yoast SEO Video Sitemap plugin if ( $query->is_home && !in_array_recursive( 'WPSEO_Video_Sitemap', $backtrace ) ) { $mbccount = 0; foreach ( $options[ 'exclude_main' ] as $value ) { $array2[$mbccount] = $value; $mbccount++; } $query->set('category__not_in', $array2); } if ( $query->is_feed ) { $mbccount = 0; foreach ( $options[ 'exclude_feed' ] as $value ) { $array2[$mbccount] = $value; $mbccount++; } $query->set( 'category__not_in', $array2 ); } if ( !is_admin() && $query->is_search ) { $mbccount = 0; foreach ( $options[ 'exclude_search' ] as $value ) { $array2[$mbccount] = $value; $mbccount++; } $query->set('category__not_in', $array2); } if ( !is_admin() && $query->is_archive ) { $mbccount = 0; foreach ( $options[ 'exclude_archives' ] as $value ) { $array2[$mbccount] = $value; $mbccount++; } $query->set( 'category__not_in', $array2 ); } return $query; } function in_array_recursive( $needle, $haystack ) { $found = false; foreach( $haystack as $item ) { if ( $item === $needle ) { $found = true; break; } elseif ( is_array( $item ) ) { $found = in_array_recursive( $needle, $item ); if( $found ) { break; } } } return $found; } ?>