php – How to exclude one parent id from post_parent’ => ‘any’, in WordPress / bbPress?

Question

The code below works well however I would like to exclude one parent id from he output.
What I’m trying to accomplish is to have [ post_parent' => 'any'] to everything except parent id=”5150″.
Is this possible?

if ( bbp_has_topics( 
   array( 
     'author' => 0, 
     'show_stickies' => false, 
     'order' => 'DESC', 
     'post_parent' => 'any', 
     'posts_per_page' => 5
   ) 
) ) {

      bbp_get_template_part( 'bbpress/loop', 'topics' );
     }`

Thank you

in progress 0
shanebp 1 month 2021-08-07T12:46:45-05:00 0 Answer 0 views 0

Answer ( 1 )

    0
    2021-08-08T08:52:06-05:00

    Have yo tried using post_parent__not_in? seems like this function uses WP_Query so all options you can pass to WP_Query should be available in this function as well.

Leave an answer

Browse
Browse