Conditional tags (all) (tag)

cat_is_ancestor_of()

Checks if the specified category is a child of another specified category (all nesting levels are checked). Conditional tag.

category_exists()

Checks if the specified category exists. If it does, it returns the ID of that category.

comments_open()

Checks if commenting is open for the specified post.

email_exists()

Checks if the specified email exists among registered users.

has_block()

Determines whether the given string or content of the given post contains the specified block (Gutenberg block editor).

has_category()

Checks whether the current or specified post has at least one of the specified categories.

has_custom_header()

Checks if an image is set for the theme header, or if a video is set and available for display on the current request page.

has_excerpt()

Checks if the current post has an excerpt (quote, short description). Conditional tag.

has_nav_menu()

Checks if a registered menu location has a menu assigned to it. Conditional tag.

has_post_thumbnail()

Checks if the specified post has a thumbnail image. Conditional tag.

has_shortcode()

Checks if the specified shortcode exists in the given text.

has_tag()

Checks if the current post has any of the given tags. A conditional tag.

has_term()

Checks if the specified post is associated with the specified taxonomy terms.

have_comments()

Checks if there are comments to display on the current post page. Conditional tag.

have_posts()

Checks if global $wp_query has posts to process. Conditional tag.

in_category()

Checks whether the current (or specified) post belongs to the specified category (multiple categories can be specified). Conditional tag.

in_the_loop()

Determines whether the caller is in The Loop (i.e. whether the loop is currently active). A conditional tag that is used to execute code only inside The Loop.

is_404()

Checks whether the 404 error page is displayed (HTTP 404: page not found). Conditional tag.

is_active_sidebar()

Checks if the specified widget panel (area for widgets, sidebar) is used. It will trigger if there is at least one widget in the widget area. Conditional tag.

is_admin()

Checks if the user is in the admin panel of the site (console or any other admin page). Conditional tag.

is_admin_bar_showing()

Checks whether the "Admin bar" (toolbar) will be shown (or has already been shown). That is, whether the admin panel will be displayed for the current user. Conditional tag.

is_archive()

Conditional tag. Return true when any of the archive pages are shown (Year, Category, Author, Post Type archive...).

is_attachment()

Checks if the current page is an attachment page. Conditional Tag.

is_author()

Checks if the author's posts page is displayed. You can specify a specific author. Conditional tag.

is_blog_admin()

Checks whether the current page—the current request—is a page in the admin area of an individual site in a WordPress MU network. Conditional tag.

is_blog_installed()

Checks if the site is installed. It checks for the presence of the siteurl option and tables in the database. The result is cached.

is_category()

Conditional tag. Checks whether the category page is displayed or not.

is_child_theme()

Checks if a child theme is being used. Conditional tag.

is_comment_feed()

Checks if the request is a comment feed page. Conditional tag.

is_customize_preview()

Checks whether the site is being previewed in the WordPress Customizer (the visual theme settings page). Conditional tag.

is_date()

Determines whether the date archive page is displayed. Conditional tag.

is_day()

Determines whether a day archive page is shown (example.com/2009/08/05) — page with posts for a specific day. A conditional tag.

is_dynamic_sidebar()

Defines whether the theme supports widgets and whether at least one sidebar has been added to the panel. Conditional tag.

is_email()

Checks if the given string is an e-mail address.

is_embed()

Checks whether the request is a request for an embed post page.

is_favicon()

Checks if the current request is a request for the favicon.ico file.

is_feed()

Checks if a feed is being requested at the current moment.

is_front_page()

Checks whether the main (home) page of the site is displayed. Conditional tag.

is_header_video_active()

Defines whether video can be displayed in the “custom‑header” area on the current page. Conditional tag.

is_home()

Checks whether the page showing posts is being displayed, usually this is the site's front page. Conditional tag.

is_local_attachment()

Determines whether the given URL is an attachment page of the current site.

is_login()

Checks if the user is on the WordPress admin login page.

is_main_query()

Checks if the action is being executed in the main WordPress loop. Conditional tag.

is_month()

Determines whether a monthly archive page is shown (example.com/2009/08) — page with posts for a specific month. A conditional tag.

is_multi_author()

Defines whether there is more than one author on the site who has published posts. Conditional tag.

is_multisite()

Checks whether multisite support is enabled on the site. Conditional tag.

is_nav_menu()

Checks for the existence of a menu by its ID, slug, or name.

is_network_admin()

Checks whether the current page is a page in the admin section "Network Admin" of the multisite. For example /wp-admin/network/. Conditional tag.

is_new_day()

Checking the difference between the current date and the previous one (in a loop). Conditional tag.

is_page()

Checks whether a "static page" is displaying. You can specify an ID, name, or page title to check a specific page. Conditional tag.

is_page_template()

Checks if the template file is used to display the current page. You can specify the name of the file.

is_paged()

Checks whether the pagination page is displayed (page type /page/2, /page/3). Conditional tag.

is_plugin_active()

Determines whether a plugin is active. Works in the dashboard only. Conditional tag.

is_post_type_archive()

Checks if current user is on the archive page of custom post type.

is_post_type_hierarchical()

Checks if the post type is hierarchical.

is_preview()

Check if the user is on the post preview page. Conditional tag

is_robots()

Checks if this is a request to robots.txt file. A conditional tag.

is_search()

Works when the search results page is displayed. Conditional tag.

is_single()

Checks whether a post page (of any post type) is displayed. Posts with attachment and page post types will not be checked. Conditional tag.

is_singular()

Checks whether the post page is viewed (post, page, attachment, any post type). Conditional Tag.

is_ssl()

Checks whether secure HTTPS (SSL) connection is used. A conditional tag.

is_sticky()

Checks if the current post is attached to the top of the home page posts query. Conditional tag.

is_tag()

Check if the tag archive page is displayed. Conditional tag.

is_tax()

Works on the custom taxonomy archive page. Conditional tag.

is_taxonomy_hierarchical()

Checks if the specified taxonomy is hierarchical. Conditional tag.

is_textdomain_loaded()

Determines if the localization file for the specified domain (translation key) is loaded.

is_time()

Determines whether the query is for a time-based archive page (page of posts for the specified time). A conditional tag.

is_trackback()

Checks if the current request is a trackback page request.

is_user_admin()

Checks if the requested page is a user page in the admin area, in a multisite network. For example: /wp-admin/user/ or /wp-admin/user/profile.php. Conditional tag.

is_user_logged_in()

Checks if the user is authorized (if the user has logged in with their username). Returns true if the user is authorized and false if not. Conditional tag.

is_year()

Determines whether a year archive page is shown (example.com/2009) — page with posts for a specific year. A conditional tag.

pings_open()

Checks if the current post is allowed to receive pings. Conditional tag.

post_exists()

Determine if a post with the specified title (post_title) exists. In addition, for the check, you can pass post_content and post_date.

post_password_required()

Checks if the post is password protected or not. Also checks the correctness of the password if a password is set for the post.

shortcode_exists()

Checks if the specified shortcode is registered.

tag_exists()

Checks if the specified tag exists. If it exists, it returns the ID or an array of data for that tag.

taxonomy_exists()

Checks if the specified taxonomy exists.

term_exists()

Check if a given taxonomy element exists. Returns either term ID or a term data if the element (term) exists.

term_is_ancestor_of()

Checks if the second term is a child of the first (all levels of nesting are checked). Conditional tag.

wp_attachment_is()

Checks if the specified attachment is: an image, audio, or video. Conditional tag.

wp_doing_ajax()

Determines whether the current request is a WordPress Ajax request.

wp_doing_cron()

Determines whether the current request is a request to Cron. Conditional tag.

wp_is_mobile()

Checks if the site is being viewed from a mobile device. Conditional tag.

wp_is_post_autosave()

Determines whether the specified post is an autosave.

wp_is_post_revision()

Determines whether the specified post is a revision.

wp_is_rest_endpoint()

Checks if the current request is a request to the REST API.

wp_is_using_https()

Checks if the site is using HTTPS.

wp_script_is()

Determines whether the script file has been registered / added to the output queue / output to the screen.