Related Posts – How to exclude a custom post status
-
Hi, I am trying to exclude posts with the custom post status “archive”. I’ve tried excluding the post status via a Jetpack hook but it doesn’t work, also I’ve added the category “archived” to all post with the post status of “archive” and then tried excluding that post category, it still does not work – these Archived posts still show up in related posts.
I’ve tried to exclude a custom post status:
function jetpackme_filter_exclude_category( $filters ) { $filters[] = array( 'not' => array( 'term' => array( 'post_status' => 'archive') ) ); return $filters; } add_filter( 'jetpack_relatedposts_filter_filters', 'jetpackme_filter_exclude_category' );
and I’ve tried to exclude a category. Only posts with post status “archived” will have this category.
function jetpackme_filter_exclude_category( $filters ) { $filters[] = array( 'not' => array( 'term' => array( 'category.slug' => 'archived') ) ); return $filters; } add_filter( 'jetpack_relatedposts_filter_filters', 'jetpackme_filter_exclude_category' );
I shouldn’t rely on post category here but I would really like to exclude the post_status if I can?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Related Posts – How to exclude a custom post status’ is closed to new replies.