Last active
August 29, 2015 14:13
-
-
Save bekarice/fed3051d33e87fd50d53 to your computer and use it in GitHub Desktop.
Exclude categories from Related Posts for WordPress
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
| /** | |
| * Removes RP4WP display when a post is in a certain category | |
| **/ | |
| function br_disable_rp4wp_category( $content ) { | |
| if ( in_category( 'excluded-category-slug' ) ) { | |
| add_filter( 'rp4wp_append_content', '__return_false'); | |
| } | |
| return $content; | |
| } | |
| add_filter( 'the_content', 'br_disable_rp4wp_category' ); | |
| // Here's how to use multiple categories instead | |
| // Replace line 6 with this & add as many categories as needed: | |
| if ( in_category( array( 'category-1-slug', 'category-2-slug', 'category-3-slug' ) ) ) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment