Created
March 31, 2017 07:49
-
-
Save barrykooij/984dd29b3992f38ae79223466085e7bf to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function rp4wp_disable_rposts_on_certain_categories( $display ) { | |
global $post; | |
// ID's of categories you wish to exclude of displaying posts | |
$excluded_categories = array( 96, 100 ); | |
$terms = wp_get_object_terms( $post->ID, 'category' ); | |
if ( ! empty( $terms ) ) { | |
foreach ( $terms as $term ) { | |
if ( in_array( $term->term_id, $excluded_categories ) ) { | |
$display = false; | |
break; | |
} | |
} | |
} | |
return $display; | |
} | |
add_filter( 'rp4wp_append_content', 'rp4wp_disable_rposts_on_certain_categories'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment