AnsPress_Tag::modify_query_archive( array|null $posts, object $query )
Description #
Modify main query to show tag archive.
Parameters #
- $postsarray | null (Required) Array of objects.
- $queryobject (Required) Wp_Query object.
Source #
File: addons/free/tag.php
public static function modify_query_archive( $posts, $query ) { if ( $query->is_main_query() && $query->is_tax( 'question_tag' ) && 'tag' === get_query_var( 'ap_page' ) ) { $query->found_posts = 1; $query->max_num_pages = 1; $page = get_page( ap_opt( 'tags_page' ) ); $page->post_title = get_queried_object()->name; $posts = [ $page ]; } return $posts; }
Expand full source code Collapse full source code View on GitHub: addons/free/tag.php:654
Add your comment