Created
January 6, 2020 13:53
-
-
Save trycycle/d5b26331cdc07c72dfd664fef32a3353 to your computer and use it in GitHub Desktop.
WordPressで特定カテゴリをRSSフィードに表示させない設定
This file contains 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 RSSCategoryFilter($query) { | |
if ($query->is_feed) { | |
$query->set('cat', '-XXX'); // XXXは除外したいカテゴリID | |
} | |
return $query; | |
} | |
add_filter('pre_get_posts', 'RSSCategoryFilter'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment