Home > Article > Backend Development > Introduction to is_singular() function in WordPress, wordpress function manual_PHP tutorial
The function is_singular() detects true when one of the following returns true: is_single(), is_page(), is_attachment(). If $post_types is specified, it is also necessary to check whether it is of this type.
Function prototype
Detailed explanation of parameters
$post_types, Post type or the type in the current query.
Return value
Returns true if the detection is successful, otherwise returns false.
Application examples
Display different advertisements under the singular page:
Returns true for normal posts:
If is_single(), is_page(), is_attachement() returns true, the following function returns true:
For custom post type book, the following function returns true:
Summary
When using paging navigation, the navigation is not displayed when is_singular().