Profile::modify_query_archive( array $posts, object $query )
Description #
Modify main query.
Parameters #
- $postsarray (Required) Array of post object.
- $queryobject (Required) Wp_Query object.
Changelog #
Source #
File: addons/profile/profile.php
public function modify_query_archive( $posts, $query ) { if ( $query->is_main_query() && ! $query->is_404 && 'user' === get_query_var( 'ap_page' ) ) { $query_object = get_queried_object(); if ( ! $query_object && ! get_query_var( 'author_name' ) && is_user_logged_in() ) { wp_safe_redirect( ap_user_link( get_current_user_id() ) ); exit; } elseif ( $query_object && $query_object instanceof \WP_User ) { return array( get_post( ap_opt( 'user_page' ) ) ); } else { $query->set_404(); status_header( 404 ); } } return $posts; }
Expand full source code Collapse full source code View on GitHub: addons/profile/profile.php:486
Add your comment