Skip to:
Content
Pages
Categories
Search
Top
Bottom

bbPress 2.3.2 now available

Viewing 2 replies - 26 through 27 (of 27 total)
  • @tamilcselvan

    Participant

    Nice to heard

    @lightningfruit

    Participant

    Weirdly (considering how long ago this was posted), I recently had some updates trigger this same problem (the ‘in_array() expects parameter 2 to be array, null given in /abcde/htdocs/wp-content/plugins/bbpress/includes/common/functions.php on line 1199’ error, though in my case it’s actually line 1442). @korvinm’s solution is great but can be extended a bit so it won’t get overwritten by updates–instead of editing the file named by the error, go into your child theme’s functions.php file and add:

    function LF_bbp_query_post_parent__in( $where, $object = '' ) {
    	global $wpdb, $wp;
    
    	// Noop if WP core supports this already
    	if ( in_array( 'post_parent__in', array($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;
    }
    remove_filter('posts_where', 'bbp_query_post_parent__in', 10);
    add_filter('posts_where', 'LF_bbp_query_post_parent__in', 10, 2);

    This keeps the edit to the function in your child theme files so it won’t get overwritten, giving it a slightly modified name, then removes the filter’s callback to the bbPress function, and adds your modified one in its place. Just figured I’d share in case anybody else is still running into this issue and comes across this thread.

Viewing 2 replies - 26 through 27 (of 27 total)
  • You must be logged in to reply to this topic.
Skip to toolbar