WordPress Conditional Functions

About This Index
This page is the WordPress Conditional Functions index. Each row links to a full guide with syntax, three examples, and FAQs.
Learn what conditional tags are and how to use them in theme files on WordPress Conditional Tags. Use this page when you need one function, such as is_front_page(), is_single(), or is_user_logged_in().
Conditional tags return true or false. Use them in if statements, and call them after the query is set, for example in template files. is_home() is the blog posts index, not the front page. is_admin() checks the dashboard, not the user role.
How to Call a Conditional Function
Put the function inside an if statement. When it returns true, the code in the braces runs.
<?php // header.php or single.php ?>
<?php if ( is_front_page() ) : ?>
<h1>Welcome!</h1>
<?php elseif ( is_single() ) : ?>
<p>You are reading a post.</p>
<?php elseif ( is_page( 'contact' ) ) : ?>
<p>Get in touch.</p>
<?php endif; ?> WordPress Conditional Functions Table
All function guides in this WordPress conditional series (34 tutorials). Start with is_front_page() and is_home().
Main query & page type
9 functionsTell the front page, blog index, single views, Pages, attachments, previews, the privacy page, and search apart.
| Function | Description | Tutorial |
|---|---|---|
is_front_page() | Check if the visitor is on the site front page. | Read guide |
is_home() | Check if the visitor is on the blog posts index. | Read guide |
is_singular() | Check if the current page is any single view: post, Page, attachment, or custom type. | Read guide |
is_single() | Check if the current page is a single blog post (not a Page). | Read guide |
is_page() | Check if the current page is a WordPress Page. | Read guide |
is_attachment() | Check if the current page is a single attachment page. | Read guide |
is_preview() | Check if a post is being viewed in preview mode. | Read guide |
is_privacy_policy() | Check if the current page is the Privacy Policy page. | Read guide |
is_search() | Check if the current page shows search results. | Read guide |
Archives & taxonomies
11 functionsCheck category, tag, author, date, time, and post type archives.
| Function | Description | Tutorial |
|---|---|---|
is_archive() | Check if the current page is any kind of archive. | Read guide |
is_category() | Check if the current page is a category archive. | Read guide |
is_tag() | Check if the current page is a tag archive. | Read guide |
is_tax() | Check if the current page is a custom taxonomy archive. | Read guide |
is_author() | Check if the current page is an author archive. | Read guide |
is_date() | Check if the current page is any date-based archive. | Read guide |
is_year() | Check if the current page is a yearly archive. | Read guide |
is_month() | Check if the current page is a monthly archive. | Read guide |
is_day() | Check if the current page is a daily archive. | Read guide |
is_time() | Check if the current page is a time-based archive (hour, minute, or second). | Read guide |
is_post_type_archive() | Check if the current page is a custom post type archive. | Read guide |
Feeds & misc query
5 functionsFeeds, trackbacks, sticky posts, new days in the loop, and page templates.
| Function | Description | Tutorial |
|---|---|---|
is_feed() | Check if the request is for an RSS, Atom, or other feed. | Read guide |
is_trackback() | Check if the request is for a trackback. | Read guide |
is_sticky() | Check if a post is a sticky post. | Read guide |
is_new_day() | Check if the current post is on a different day than the previous post. | Read guide |
is_page_template() | Check if the current Page uses a custom page template. | Read guide |
Site, user & plugins
9 functionsCheck the dashboard, login state, Multisite, child themes, plugins, and widget areas.
| Function | Description | Tutorial |
|---|---|---|
is_admin() | Check if the request is for the WordPress admin area (wp-admin). | Read guide |
is_user_logged_in() | Check if the visitor is logged in. | Read guide |
is_multisite() | Check if WordPress Multisite (a network of sites) is enabled. | Read guide |
is_main_site() | Check if a site is the main site of a multisite network. | Read guide |
is_super_admin() | Check if a user is a Super Admin (network administrator). | Read guide |
is_multi_author() | Check if the site has more than one author with published posts. | Read guide |
is_child_theme() | Check if a child theme is active. | Read guide |
is_plugin_active() | Check if a plugin is active on the current site. | Read guide |
is_active_sidebar() | Check if a sidebar (widget area) has at least one widget. | Read guide |
Frequently Asked Questions
Start with is_active_sidebar()
Check if a sidebar (widget area) has at least one widget.
15 people found this page helpful
