Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/is single


This conditional tag checks if a single post of any post type (except attachment and page post types) is being displayed. If the $post parameter is specified, the function will additionally check if the query is for one of the posts specified. To check for all the post types, use the is_singular() function.


<?php is_single($post); ?>


(mixed) (optional) Post ID, Post Title, Post Slug, or array of posts (WP 2.5+)
Default: None

Return Values

True on success, false on failure.


// When any single Post page is being displayed.

// When Post 17 (ID) is being displayed.

// When Post 17 (ID) is being displayed. Integer parameter also works
is_single('Irish Stew');
// When the Post with post_title of "Irish Stew" is being displayed.

// When the Post with post_name (slug) of "beef-stew" is being displayed.

is_single(array(17,'beef-stew','Irish Stew'));
// Returns true when the single post being displayed is either post ID 17, or the post_name is "beef-stew", or the post_title is "Irish Stew".  Note: the array ability was added at Version 2.5.


  • See Also: is_singular()
  • Although is_single() will usually return true for attachments, this behavior should not be relied upon. It is possible for $is_page and $is_attachment to be true at the same time, and in that case $is_single will be false. For this reason, you should use is_attachment() || is_single() if you want to include attachments, or use is_singular() if you want to include pages too. See ticket #14034 for more information.

Change Log

Since: 1.5.0

Source File

is_single() is located in wp-includes/query.php.


See also index of Function Reference and index of Template Tags.