This page redirects to an external site: https://developer.wordpress.org/reference/functions/is_single/
Languages: English • Русский • Español • single 日本語 한국어 • Türkçe • (Add your language)
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); ?>
is_single();
// When any single Post page is being displayed.
is_single('17');
// When Post 17 (ID) is being displayed.
is_single(17);
// 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.
is_single('beef-stew');
// 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.
Since: 1.5.0
is_single() is located in wp-includes/query.php.