This function has been deprecated. bbPress (r5820) instead.

bbp_query_post_parent__in( string $where, WP_Query $object = '' )

Adds ability to include or exclude specific post_parent ID’s

Description

Parameters

$where

(Required)

$object

(Optional)

Default value: ''

Return

(string)

Source

File: bp-forums/common/functions.php

1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
function bbp_query_post_parent__in( $where, $object = '' ) {
    global $wpdb, $wp;
 
    // Noop if WP core supports this already
    if ( in_array( 'post_parent__in', $wp->private_query_vars ) )
        return $where;
 
    // Bail if no object passed
    if ( empty( $object ) )
        return $where;
 
    // Only 1 post_parent so return $where
    if ( is_numeric( $object->query_vars['post_parent'] ) )
        return $where;
 
    // Including specific post_parent's
    if ( ! empty( $object->query_vars['post_parent__in'] ) ) {
        $ids    = implode( ',', wp_parse_id_list( $object->query_vars['post_parent__in'] ) );
        $where .= " AND {$wpdb->posts}.post_parent IN ($ids)";
 
    // Excluding specific post_parent's
    } elseif ( ! empty( $object->query_vars['post_parent__not_in'] ) ) {
        $ids    = implode( ',', wp_parse_id_list( $object->query_vars['post_parent__not_in'] ) );
        $where .= " AND {$wpdb->posts}.post_parent NOT IN ($ids)";
    }
 
    // Return possibly modified $where
    return $where;
}

Changelog

Changelog
Version Description
bbPress (r2996) Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.