Docs: Improve @return tags for various conditional tags.

Props stevenlinx, SergeyBiryukov.
Fixes #50626.

git-svn-id: https://develop.svn.wordpress.org/trunk@48426 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-07-10 20:21:01 +00:00
parent a7a91ba8dc
commit 72d5862069
3 changed files with 60 additions and 56 deletions

View File

@@ -148,7 +148,7 @@ function wp_reset_postdata() {
*
* @global WP_Query $wp_query WordPress Query object.
*
* @return bool
* @return bool Whether the query is for an existing archive page.
*/
function is_archive() {
global $wp_query;
@@ -174,7 +174,7 @@ function is_archive() {
*
* @param string|string[] $post_types Optional. Post type or array of posts types
* to check against. Default empty.
* @return bool
* @return bool Whether the query is for an existing post type archive page.
*/
function is_post_type_archive( $post_types = '' ) {
global $wp_query;
@@ -200,7 +200,7 @@ function is_post_type_archive( $post_types = '' ) {
*
* @param int|string|int[]|string[] $attachment Optional. Attachment ID, title, slug, or array of such
* to check against. Default empty.
* @return bool
* @return bool Whether the query is for an existing attachment page.
*/
function is_attachment( $attachment = '' ) {
global $wp_query;
@@ -229,7 +229,7 @@ function is_attachment( $attachment = '' ) {
*
* @param int|string|int[]|string[] $author Optional. User ID, nickname, nicename, or array of such
* to check against. Default empty.
* @return bool
* @return bool Whether the query is for an existing author archive page.
*/
function is_author( $author = '' ) {
global $wp_query;
@@ -258,7 +258,7 @@ function is_author( $author = '' ) {
*
* @param int|string|int[]|string[] $category Optional. Category ID, name, slug, or array of such
* to check against. Default empty.
* @return bool
* @return bool Whether the query is for an existing category archive page.
*/
function is_category( $category = '' ) {
global $wp_query;
@@ -287,7 +287,7 @@ function is_category( $category = '' ) {
*
* @param int|string|int[]|string[] $tag Optional. Tag ID, name, slug, or array of such
* to check against. Default empty.
* @return bool
* @return bool Whether the query is for an existing tag archive page.
*/
function is_tag( $tag = '' ) {
global $wp_query;
@@ -322,7 +322,8 @@ function is_tag( $tag = '' ) {
* Default empty.
* @param int|string|int[]|string[] $term Optional. Term ID, name, slug, or array of such
* to check against. Default empty.
* @return bool True for custom taxonomy archive pages, false for built-in taxonomies
* @return bool Whether the query is for an existing custom taxonomy archive page.
* True for custom taxonomy archive pages, false for built-in taxonomies
* (category and tag archives).
*/
function is_tax( $taxonomy = '', $term = '' ) {
@@ -347,7 +348,7 @@ function is_tax( $taxonomy = '', $term = '' ) {
*
* @global WP_Query $wp_query WordPress Query object.
*
* @return bool
* @return bool Whether the query is for an existing date archive.
*/
function is_date() {
global $wp_query;
@@ -373,7 +374,7 @@ function is_date() {
*
* @global WP_Query $wp_query WordPress Query object.
*
* @return bool
* @return bool Whether the query is for an existing day archive.
*/
function is_day() {
global $wp_query;
@@ -399,7 +400,7 @@ function is_day() {
*
* @param string|string[] $feeds Optional. Feed type or array of feed types
* to check against. Default empty.
* @return bool
* @return bool Whether the query is for a feed.
*/
function is_feed( $feeds = '' ) {
global $wp_query;
@@ -419,7 +420,7 @@ function is_feed( $feeds = '' ) {
*
* @global WP_Query $wp_query WordPress Query object.
*
* @return bool
* @return bool Whether the query is for a comments feed.
*/
function is_comment_feed() {
global $wp_query;
@@ -452,7 +453,7 @@ function is_comment_feed() {
*
* @global WP_Query $wp_query WordPress Query object.
*
* @return bool True, if front of site.
* @return bool Whether the query is for the front page of the site.
*/
function is_front_page() {
global $wp_query;
@@ -485,7 +486,7 @@ function is_front_page() {
* @see is_front_page()
* @global WP_Query $wp_query WordPress Query object.
*
* @return bool True if blog view homepage, otherwise false.
* @return bool Whether the query is for the blog homepage.
*/
function is_home() {
global $wp_query;
@@ -515,7 +516,7 @@ function is_home() {
*
* @global WP_Query $wp_query WordPress Query object.
*
* @return bool
* @return bool Whether the query is for the Privacy Policy page.
*/
function is_privacy_policy() {
global $wp_query;
@@ -539,7 +540,7 @@ function is_privacy_policy() {
*
* @global WP_Query $wp_query WordPress Query object.
*
* @return bool
* @return bool Whether the query is for an existing month archive.
*/
function is_month() {
global $wp_query;
@@ -585,7 +586,7 @@ function is_page( $page = '' ) {
}
/**
* Determines whether the query is for paged results and not for the first page.
* Determines whether the query is for a paged result and not for the first page.
*
* For more information on this and similar theme functions, check out
* the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
@@ -595,7 +596,7 @@ function is_page( $page = '' ) {
*
* @global WP_Query $wp_query WordPress Query object.
*
* @return bool
* @return bool Whether the query is for a paged result.
*/
function is_paged() {
global $wp_query;
@@ -619,7 +620,7 @@ function is_paged() {
*
* @global WP_Query $wp_query WordPress Query object.
*
* @return bool
* @return bool Whether the query is for a post or page preview.
*/
function is_preview() {
global $wp_query;
@@ -639,7 +640,7 @@ function is_preview() {
*
* @global WP_Query $wp_query WordPress Query object.
*
* @return bool
* @return bool Whether the query is for the robots.txt file.
*/
function is_robots() {
global $wp_query;
@@ -659,7 +660,7 @@ function is_robots() {
*
* @global WP_Query $wp_query WordPress Query object.
*
* @return bool
* @return bool Whether the query is for the favicon.ico file.
*/
function is_favicon() {
global $wp_query;
@@ -683,7 +684,7 @@ function is_favicon() {
*
* @global WP_Query $wp_query WordPress Query object.
*
* @return bool
* @return bool Whether the query is for a search.
*/
function is_search() {
global $wp_query;
@@ -775,7 +776,7 @@ function is_singular( $post_types = '' ) {
*
* @global WP_Query $wp_query WordPress Query object.
*
* @return bool
* @return bool Whether the query is for a specific time.
*/
function is_time() {
global $wp_query;
@@ -799,7 +800,7 @@ function is_time() {
*
* @global WP_Query $wp_query WordPress Query object.
*
* @return bool
* @return bool Whether the query is for a trackback endpoint call.
*/
function is_trackback() {
global $wp_query;
@@ -823,7 +824,7 @@ function is_trackback() {
*
* @global WP_Query $wp_query WordPress Query object.
*
* @return bool
* @return bool Whether the query is for an existing year archive.
*/
function is_year() {
global $wp_query;
@@ -847,7 +848,7 @@ function is_year() {
*
* @global WP_Query $wp_query WordPress Query object.
*
* @return bool
* @return bool Whether the query is a 404 error.
*/
function is_404() {
global $wp_query;
@@ -867,7 +868,7 @@ function is_404() {
*
* @global WP_Query $wp_query WordPress Query object.
*
* @return bool Whether we're in an embedded post or not.
* @return bool Whether the query is for an embedded post.
*/
function is_embed() {
global $wp_query;
@@ -891,7 +892,7 @@ function is_embed() {
*
* @global WP_Query $wp_query WordPress Query object.
*
* @return bool
* @return bool Whether the query is the main query.
*/
function is_main_query() {
if ( 'pre_get_posts' === current_filter() ) {