: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* Makes private properties checkable for backward compatibility.
* @param string $name Property to check if set.
* @return bool Whether the property is set.
public function __isset( $name ) {
if ( in_array( $name, $this->compat_fields, true ) ) {
return isset( $this->$name );
* Makes private/protected methods readable for backward compatibility.
* @param string $name Method to call.
* @param array $arguments Arguments to pass when calling.
* @return mixed|false Return value of the callback, false otherwise.
public function __call( $name, $arguments ) {
if ( in_array( $name, $this->compat_methods, true ) ) {
return $this->$name( ...$arguments );
* Determines whether the query is for an existing archive page.
* Archive pages include category, tag, author, date, custom post type,
* and custom taxonomy based archives.
* @see WP_Query::is_category()
* @see WP_Query::is_tag()
* @see WP_Query::is_author()
* @see WP_Query::is_date()
* @see WP_Query::is_post_type_archive()
* @see WP_Query::is_tax()
* @return bool Whether the query is for an existing archive page.
public function is_archive() {
return (bool) $this->is_archive;
* Determines whether the query is for an existing post type archive page.
* @param string|string[] $post_types Optional. Post type or array of posts types
* to check against. Default empty.
* @return bool Whether the query is for an existing post type archive page.
public function is_post_type_archive( $post_types = '' ) {
if ( empty( $post_types ) || ! $this->is_post_type_archive ) {
return (bool) $this->is_post_type_archive;
$post_type = $this->get( 'post_type' );
if ( is_array( $post_type ) ) {
$post_type = reset( $post_type );
$post_type_object = get_post_type_object( $post_type );
if ( ! $post_type_object ) {
return in_array( $post_type_object->name, (array) $post_types, true );
* Determines whether the query is for an existing attachment page.
* @param int|string|int[]|string[] $attachment Optional. Attachment ID, title, slug, or array of such
* to check against. Default empty.
* @return bool Whether the query is for an existing attachment page.
public function is_attachment( $attachment = '' ) {
if ( ! $this->is_attachment ) {
if ( empty( $attachment ) ) {
$attachment = array_map( 'strval', (array) $attachment );
$post_obj = $this->get_queried_object();
if ( in_array( (string) $post_obj->ID, $attachment, true ) ) {
} elseif ( in_array( $post_obj->post_title, $attachment, true ) ) {
} elseif ( in_array( $post_obj->post_name, $attachment, true ) ) {
* Determines whether the query is for an existing author archive page.
* If the $author parameter is specified, this function will additionally
* check if the query is for one of the authors specified.
* @param int|string|int[]|string[] $author Optional. User ID, nickname, nicename, or array of such
* to check against. Default empty.
* @return bool Whether the query is for an existing author archive page.
public function is_author( $author = '' ) {
if ( ! $this->is_author ) {
if ( empty( $author ) ) {
$author_obj = $this->get_queried_object();
$author = array_map( 'strval', (array) $author );
if ( in_array( (string) $author_obj->ID, $author, true ) ) {
} elseif ( in_array( $author_obj->nickname, $author, true ) ) {
} elseif ( in_array( $author_obj->user_nicename, $author, true ) ) {
* Determines whether the query is for an existing category archive page.
* If the $category parameter is specified, this function will additionally
* check if the query is for one of the categories specified.
* @param int|string|int[]|string[] $category Optional. Category ID, name, slug, or array of such
* to check against. Default empty.
* @return bool Whether the query is for an existing category archive page.
public function is_category( $category = '' ) {
if ( ! $this->is_category ) {
if ( empty( $category ) ) {
$cat_obj = $this->get_queried_object();
$category = array_map( 'strval', (array) $category );
if ( in_array( (string) $cat_obj->term_id, $category, true ) ) {
} elseif ( in_array( $cat_obj->name, $category, true ) ) {
} elseif ( in_array( $cat_obj->slug, $category, true ) ) {
* Determines whether the query is for an existing tag archive page.
* If the $tag parameter is specified, this function will additionally
* check if the query is for one of the tags specified.
* @param int|string|int[]|string[] $tag Optional. Tag ID, name, slug, or array of such
* to check against. Default empty.
* @return bool Whether the query is for an existing tag archive page.
public function is_tag( $tag = '' ) {
$tag_obj = $this->get_queried_object();
$tag = array_map( 'strval', (array) $tag );
if ( in_array( (string) $tag_obj->term_id, $tag, true ) ) {
} elseif ( in_array( $tag_obj->name, $tag, true ) ) {
} elseif ( in_array( $tag_obj->slug, $tag, true ) ) {
* Determines whether the query is for an existing custom taxonomy archive page.
* If the $taxonomy parameter is specified, this function will additionally
* check if the query is for that specific $taxonomy.
* If the $term parameter is specified in addition to the $taxonomy parameter,
* this function will additionally check if the query is for one of the terms
* @global WP_Taxonomy[] $wp_taxonomies Registered taxonomies.
* @param string|string[] $taxonomy Optional. Taxonomy slug or slugs to check against.
* @param int|string|int[]|string[] $term Optional. Term ID, name, slug, or array of such
* to check against. Default empty.
* @return bool Whether the query is for an existing custom taxonomy archive page.
* True for custom taxonomy archive pages, false for built-in taxonomies
* (category and tag archives).
public function is_tax( $taxonomy = '', $term = '' ) {
if ( empty( $taxonomy ) ) {
$queried_object = $this->get_queried_object();
$tax_array = array_intersect( array_keys( $wp_taxonomies ), (array) $taxonomy );
$term_array = (array) $term;
// Check that the taxonomy matches.
if ( ! ( isset( $queried_object->taxonomy ) && count( $tax_array ) && in_array( $queried_object->taxonomy, $tax_array, true ) ) ) {
// Only a taxonomy provided.
return isset( $queried_object->term_id ) &&
array( $queried_object->term_id, $queried_object->name, $queried_object->slug ),
* Determines whether the current URL is within the comments popup window.
* @return false Always returns false.
public function is_comments_popup() {
_deprecated_function( __FUNCTION__, '4.5.0' );
* Determines whether the query is for an existing date archive.
* @return bool Whether the query is for an existing date archive.
public function is_date() {
return (bool) $this->is_date;
* Determines whether the query is for an existing day archive.
* @return bool Whether the query is for an existing day archive.
public function is_day() {
return (bool) $this->is_day;
* Determines whether the query is for a feed.
* @param string|string[] $feeds Optional. Feed type or array of feed types
* to check against. Default empty.
* @return bool Whether the query is for a feed.
public function is_feed( $feeds = '' ) {
if ( empty( $feeds ) || ! $this->is_feed ) {
return (bool) $this->is_feed;
$qv = $this->get( 'feed' );
$qv = get_default_feed();
return in_array( $qv, (array) $feeds, true );
* Determines whether the query is for a comments feed.
* @return bool Whether the query is for a comments feed.
public function is_comment_feed() {
return (bool) $this->is_comment_feed;
* Determines whether the query is for the front page of the site.
* This is for what is displayed at your site's main URL.
* Depends on the site's "Front page displays" Reading Settings 'show_on_front' and 'page_on_front'.
* If you set a static page for the front page of your site, this function will return
* true when viewing that page.
* Otherwise the same as {@see WP_Query::is_home()}.
* @return bool Whether the query is for the front page of the site.
public function is_front_page() {
if ( 'posts' === get_option( 'show_on_front' ) && $this->is_home() ) {
} elseif ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' )
&& $this->is_page( get_option( 'page_on_front' ) )
* Determines whether the query is for the blog homepage.
* This is the page which shows the time based blog content of your site.
* Depends on the site's "Front page displays" Reading Settings 'show_on_front' and 'page_for_posts'.
* If you set a static page for the front page of your site, this function will return
* true only on the page you set as the "Posts page".
* @see WP_Query::is_front_page()
* @return bool Whether the query is for the blog homepage.
public function is_home() {
return (bool) $this->is_home;
* Determines whether the query is for the Privacy Policy page.
* This is the page which shows the Privacy Policy content of your site.
* Depends on the site's "Change your Privacy Policy page" Privacy Settings 'wp_page_for_privacy_policy'.
* This function will return true only on the page you set as the "Privacy Policy page".
* @return bool Whether the query is for the Privacy Policy page.
public function is_privacy_policy() {
if ( get_option( 'wp_page_for_privacy_policy' )
&& $this->is_page( get_option( 'wp_page_for_privacy_policy' ) )
* Determines whether the query is for an existing month archive.
* @return bool Whether the query is for an existing month archive.
public function is_month() {
return (bool) $this->is_month;
* Determines whether the query is for an existing single page.
* If the $page parameter is specified, this function will additionally
* check if the query is for one of the pages specified.
* @see WP_Query::is_single()
* @see WP_Query::is_singular()
* @param int|string|int[]|string[] $page Optional. Page ID, title, slug, path, or array of such
* to check against. Default empty.
* @return bool Whether the query is for an existing single page.
public function is_page( $page = '' ) {
if ( ! $this->is_page ) {
$page_obj = $this->get_queried_object();
$page = array_map( 'strval', (array) $page );
if ( in_array( (string) $page_obj->ID, $page, true ) ) {
} elseif ( in_array( $page_obj->post_title, $page, true ) ) {
} elseif ( in_array( $page_obj->post_name, $page, true ) ) {
foreach ( $page as $pagepath ) {
if ( ! strpos( $pagepath, '/' ) ) {
$pagepath_obj = get_page_by_path( $pagepath );
if ( $pagepath_obj && ( $pagepath_obj->ID == $page_obj->ID ) ) {
* Determines whether the query is for a paged result and not for the first page.
* @return bool Whether the query is for a paged result.
public function is_paged() {