bbp_posts_pre_query( mixed $posts = null, WP_Query $wp_query = false )
Maybe pre-assign the posts that are returned from a WP_Query.
Description Description
This effectively short-circuits the default query for posts, which is currently only used to avoid calling the main query when it’s not necessary.
Parameters Parameters
- $posts
-
(Optional) Array of posts (possibly empty)
Default value: null
- $wp_query
-
(Optional)
Default value: false
Return Return
(mixed) Null if no override. Array if overridden.
Source Source
File: includes/common/functions.php
function bbp_posts_pre_query( $posts = null, $wp_query = false ) { // Custom 404 handler is set, so set posts to empty array to avoid 2 queries if ( ! empty( $wp_query->bbp_is_404 ) ) { $posts = array(); } // Return, maybe overridden return $posts; }
Changelog Changelog
Version | Description |
---|---|
2.6.0 | Introduced. |