WordPress.org

Make WordPress Core

Changeset 48426


Ignore:
Timestamp:
07/10/2020 08:21:01 PM (3 months ago)
Author:
SergeyBiryukov
Message:

Docs: Improve @return tags for various conditional tags.

Props stevenlinx, SergeyBiryukov.
Fixes #50626.

Location:
trunk/src/wp-includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-query.php

    r48406 r48426  
    36063606     * @since 3.1.0
    36073607     *
    3608      * @return bool
     3608     * @return bool Whether the query is for an existing archive page.
    36093609     */
    36103610    public function is_archive() {
     
    36193619     * @param string|string[] $post_types Optional. Post type or array of posts types
    36203620     *                                    to check against. Default empty.
    3621      * @return bool
     3621     * @return bool Whether the query is for an existing post type archive page.
    36223622     */
    36233623    public function is_post_type_archive( $post_types = '' ) {
     
    36423642     * @param int|string|int[]|string[] $attachment Optional. Attachment ID, title, slug, or array of such
    36433643     *                                              to check against. Default empty.
    3644      * @return bool
     3644     * @return bool Whether the query is for an existing attachment page.
    36453645     */
    36463646    public function is_attachment( $attachment = '' ) {
     
    36773677     * @param int|string|int[]|string[] $author Optional. User ID, nickname, nicename, or array of such
    36783678     *                                          to check against. Default empty.
    3679      * @return bool
     3679     * @return bool Whether the query is for an existing author archive page.
    36803680     */
    36813681    public function is_author( $author = '' ) {
     
    37133713     * @param int|string|int[]|string[] $category Optional. Category ID, name, slug, or array of such
    37143714     *                                            to check against. Default empty.
    3715      * @return bool
     3715     * @return bool Whether the query is for an existing category archive page.
    37163716     */
    37173717    public function is_category( $category = '' ) {
     
    37493749     * @param int|string|int[]|string[] $tag Optional. Tag ID, name, slug, or array of such
    37503750     *                                       to check against. Default empty.
    3751      * @return bool
     3751     * @return bool Whether the query is for an existing tag archive page.
    37523752     */
    37533753    public function is_tag( $tag = '' ) {
     
    37933793     * @param int|string|int[]|string[] $term     Optional. Term ID, name, slug, or array of such
    37943794     *                                            to check against. Default empty.
    3795      * @return bool True for custom taxonomy archive pages, false for built-in taxonomies
     3795     * @return bool Whether the query is for an existing custom taxonomy archive page.
     3796     *              True for custom taxonomy archive pages, false for built-in taxonomies
    37963797     *              (category and tag archives).
    37973798     */
     
    38363837     * @deprecated 4.5.0
    38373838     *
    3838      * @return bool
     3839     * @return false Always returns false.
    38393840     */
    38403841    public function is_comments_popup() {
     
    38493850     * @since 3.1.0
    38503851     *
    3851      * @return bool
     3852     * @return bool Whether the query is for an existing date archive.
    38523853     */
    38533854    public function is_date() {
     
    38603861     * @since 3.1.0
    38613862     *
    3862      * @return bool
     3863     * @return bool Whether the query is for an existing day archive.
    38633864     */
    38643865    public function is_day() {
     
    38733874     * @param string|string[] $feeds Optional. Feed type or array of feed types
    38743875     *                                         to check against. Default empty.
    3875      * @return bool
     3876     * @return bool Whether the query is for a feed.
    38763877     */
    38773878    public function is_feed( $feeds = '' ) {
     
    38793880            return (bool) $this->is_feed;
    38803881        }
     3882
    38813883        $qv = $this->get( 'feed' );
    38823884        if ( 'feed' === $qv ) {
    38833885            $qv = get_default_feed();
    38843886        }
     3887
    38853888        return in_array( $qv, (array) $feeds, true );
    38863889    }
     
    38913894     * @since 3.1.0
    38923895     *
    3893      * @return bool
     3896     * @return bool Whether the query is for a comments feed.
    38943897     */
    38953898    public function is_comment_feed() {
     
    39113914     * @since 3.1.0
    39123915     *
    3913      * @return bool True, if front of site.
     3916     * @return bool Whether the query is for the front page of the site.
    39143917     */
    39153918    public function is_front_page() {
     
    39403943     * @since 3.1.0
    39413944     *
    3942      * @return bool True if blog view homepage.
     3945     * @return bool Whether the query is for the blog homepage.
    39433946     */
    39443947    public function is_home() {
     
    39573960     * @since 5.2.0
    39583961     *
    3959      * @return bool True, if Privacy Policy page.
     3962     * @return bool Whether the query is for the Privacy Policy page.
    39603963     */
    39613964    public function is_privacy_policy() {
     
    39743977     * @since 3.1.0
    39753978     *
    3976      * @return bool
     3979     * @return bool Whether the query is for an existing month archive.
    39773980     */
    39783981    public function is_month() {
     
    40314034
    40324035    /**
    4033      * Is the query for paged result and not for the first page?
     4036     * Is the query for a paged result and not for the first page?
    40344037     *
    40354038     * @since 3.1.0
    40364039     *
    4037      * @return bool
     4040     * @return bool Whether the query is for a paged result.
    40384041     */
    40394042    public function is_paged() {
     
    40464049     * @since 3.1.0
    40474050     *
    4048      * @return bool
     4051     * @return bool Whether the query is for a post or page preview.
    40494052     */
    40504053    public function is_preview() {
     
    40574060     * @since 3.1.0
    40584061     *
    4059      * @return bool
     4062     * @return bool Whether the query is for the robots.txt file.
    40604063     */
    40614064    public function is_robots() {
     
    40684071     * @since 5.4.0
    40694072     *
    4070      * @return bool
     4073     * @return bool Whether the query is for the favicon.ico file.
    40714074     */
    40724075    public function is_favicon() {
     
    40794082     * @since 3.1.0
    40804083     *
    4081      * @return bool
     4084     * @return bool Whether the query is for a search.
    40824085     */
    40834086    public function is_search() {
     
    41684171     * @since 3.1.0
    41694172     *
    4170      * @return bool
     4173     * @return bool Whether the query is for a specific time.
    41714174     */
    41724175    public function is_time() {
     
    41794182     * @since 3.1.0
    41804183     *
    4181      * @return bool
     4184     * @return bool Whether the query is for a trackback endpoint call.
    41824185     */
    41834186    public function is_trackback() {
     
    41904193     * @since 3.1.0
    41914194     *
    4192      * @return bool
     4195     * @return bool Whether the query is for an existing year archive.
    41934196     */
    41944197    public function is_year() {
     
    42014204     * @since 3.1.0
    42024205     *
    4203      * @return bool
     4206     * @return bool Whether the query is a 404 error.
    42044207     */
    42054208    public function is_404() {
     
    42124215     * @since 4.4.0
    42134216     *
    4214      * @return bool
     4217     * @return bool Whether the query is for an embedded post.
    42154218     */
    42164219    public function is_embed() {
     
    42254228     * @global WP_Query $wp_query WordPress Query object.
    42264229     *
    4227      * @return bool
     4230     * @return bool Whether the query is the main query.
    42284231     */
    42294232    public function is_main_query() {
  • trunk/src/wp-includes/deprecated.php

    r48200 r48426  
    37503750 * @deprecated 4.5.0
    37513751 *
    3752  * @return bool
     3752 * @return false Always returns false.
    37533753 */
    37543754function is_comments_popup() {
  • trunk/src/wp-includes/query.php

    r48407 r48426  
    149149 * @global WP_Query $wp_query WordPress Query object.
    150150 *
    151  * @return bool
     151 * @return bool Whether the query is for an existing archive page.
    152152 */
    153153function is_archive() {
     
    175175 * @param string|string[] $post_types Optional. Post type or array of posts types
    176176 *                                    to check against. Default empty.
    177  * @return bool
     177 * @return bool Whether the query is for an existing post type archive page.
    178178 */
    179179function is_post_type_archive( $post_types = '' ) {
     
    201201 * @param int|string|int[]|string[] $attachment Optional. Attachment ID, title, slug, or array of such
    202202 *                                              to check against. Default empty.
    203  * @return bool
     203 * @return bool Whether the query is for an existing attachment page.
    204204 */
    205205function is_attachment( $attachment = '' ) {
     
    230230 * @param int|string|int[]|string[] $author Optional. User ID, nickname, nicename, or array of such
    231231 *                                          to check against. Default empty.
    232  * @return bool
     232 * @return bool Whether the query is for an existing author archive page.
    233233 */
    234234function is_author( $author = '' ) {
     
    259259 * @param int|string|int[]|string[] $category Optional. Category ID, name, slug, or array of such
    260260 *                                            to check against. Default empty.
    261  * @return bool
     261 * @return bool Whether the query is for an existing category archive page.
    262262 */
    263263function is_category( $category = '' ) {
     
    288288 * @param int|string|int[]|string[] $tag Optional. Tag ID, name, slug, or array of such
    289289 *                                       to check against. Default empty.
    290  * @return bool
     290 * @return bool Whether the query is for an existing tag archive page.
    291291 */
    292292function is_tag( $tag = '' ) {
     
    323323 * @param int|string|int[]|string[] $term     Optional. Term ID, name, slug, or array of such
    324324 *                                            to check against. Default empty.
    325  * @return bool True for custom taxonomy archive pages, false for built-in taxonomies
     325 * @return bool Whether the query is for an existing custom taxonomy archive page.
     326 *              True for custom taxonomy archive pages, false for built-in taxonomies
    326327 *              (category and tag archives).
    327328 */
     
    348349 * @global WP_Query $wp_query WordPress Query object.
    349350 *
    350  * @return bool
     351 * @return bool Whether the query is for an existing date archive.
    351352 */
    352353function is_date() {
     
    374375 * @global WP_Query $wp_query WordPress Query object.
    375376 *
    376  * @return bool
     377 * @return bool Whether the query is for an existing day archive.
    377378 */
    378379function is_day() {
     
    400401 * @param string|string[] $feeds Optional. Feed type or array of feed types
    401402 *                                         to check against. Default empty.
    402  * @return bool
     403 * @return bool Whether the query is for a feed.
    403404 */
    404405function is_feed( $feeds = '' ) {
     
    420421 * @global WP_Query $wp_query WordPress Query object.
    421422 *
    422  * @return bool
     423 * @return bool Whether the query is for a comments feed.
    423424 */
    424425function is_comment_feed() {
     
    453454 * @global WP_Query $wp_query WordPress Query object.
    454455 *
    455  * @return bool True, if front of site.
     456 * @return bool Whether the query is for the front page of the site.
    456457 */
    457458function is_front_page() {
     
    486487 * @global WP_Query $wp_query WordPress Query object.
    487488 *
    488  * @return bool True if blog view homepage, otherwise false.
     489 * @return bool Whether the query is for the blog homepage.
    489490 */
    490491function is_home() {
     
    516517 * @global WP_Query $wp_query WordPress Query object.
    517518 *
    518  * @return bool
     519 * @return bool Whether the query is for the Privacy Policy page.
    519520 */
    520521function is_privacy_policy() {
     
    540541 * @global WP_Query $wp_query WordPress Query object.
    541542 *
    542  * @return bool
     543 * @return bool Whether the query is for an existing month archive.
    543544 */
    544545function is_month() {
     
    586587
    587588/**
    588  * Determines whether the query is for paged results and not for the first page.
    589  *
    590  * For more information on this and similar theme functions, check out
    591  * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
    592  * Conditional Tags} article in the Theme Developer Handbook.
    593  *
    594  * @since 1.5.0
    595  *
    596  * @global WP_Query $wp_query WordPress Query object.
    597  *
    598  * @return bool
     589 * Determines whether the query is for a paged result and not for the first page.
     590 *
     591 * For more information on this and similar theme functions, check out
     592 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
     593 * Conditional Tags} article in the Theme Developer Handbook.
     594 *
     595 * @since 1.5.0
     596 *
     597 * @global WP_Query $wp_query WordPress Query object.
     598 *
     599 * @return bool Whether the query is for a paged result.
    599600 */
    600601function is_paged() {
     
    620621 * @global WP_Query $wp_query WordPress Query object.
    621622 *
    622  * @return bool
     623 * @return bool Whether the query is for a post or page preview.
    623624 */
    624625function is_preview() {
     
    640641 * @global WP_Query $wp_query WordPress Query object.
    641642 *
    642  * @return bool
     643 * @return bool Whether the query is for the robots.txt file.
    643644 */
    644645function is_robots() {
     
    660661 * @global WP_Query $wp_query WordPress Query object.
    661662 *
    662  * @return bool
     663 * @return bool Whether the query is for the favicon.ico file.
    663664 */
    664665function is_favicon() {
     
    684685 * @global WP_Query $wp_query WordPress Query object.
    685686 *
    686  * @return bool
     687 * @return bool Whether the query is for a search.
    687688 */
    688689function is_search() {
     
    776777 * @global WP_Query $wp_query WordPress Query object.
    777778 *
    778  * @return bool
     779 * @return bool Whether the query is for a specific time.
    779780 */
    780781function is_time() {
     
    800801 * @global WP_Query $wp_query WordPress Query object.
    801802 *
    802  * @return bool
     803 * @return bool Whether the query is for a trackback endpoint call.
    803804 */
    804805function is_trackback() {
     
    824825 * @global WP_Query $wp_query WordPress Query object.
    825826 *
    826  * @return bool
     827 * @return bool Whether the query is for an existing year archive.
    827828 */
    828829function is_year() {
     
    848849 * @global WP_Query $wp_query WordPress Query object.
    849850 *
    850  * @return bool
     851 * @return bool Whether the query is a 404 error.
    851852 */
    852853function is_404() {
     
    868869 * @global WP_Query $wp_query WordPress Query object.
    869870 *
    870  * @return bool Whether we're in an embedded post or not.
     871 * @return bool Whether the query is for an embedded post.
    871872 */
    872873function is_embed() {
     
    892893 * @global WP_Query $wp_query WordPress Query object.
    893894 *
    894  * @return bool
     895 * @return bool Whether the query is the main query.
    895896 */
    896897function is_main_query() {
Note: See TracChangeset for help on using the changeset viewer.