AP_QA_Query_Hooks::modify_main_posts( array $posts, object $query )
Description #
Modify main query.
Parameters #
- $postsarray (Required) Array of post object.
- $queryobject (Required) Wp_Query object.
Source #
File: includes/qaquery-hooks.php
public static function modify_main_posts( $posts, $query ) { if ( ! is_admin() && $query->is_main_query() && $query->is_search() && 'question' === get_query_var( 'post_type' ) ) { $query->found_posts = 1; $query->max_num_pages = 1; $posts = array( get_post( ap_opt( 'base_page' ) ) ); } return $posts; }
Expand full source code Collapse full source code View on GitHub: includes/qaquery-hooks.php:206
Add your comment