Make WordPress Core


Ignore:
Timestamp:
06/15/2021 03:21:50 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Remove a one-time $message variable in some _doing_it_wrong() calls.

This brings some consistency with most other calls.

Follow-up to [23378], [25605], [34745], [36219], [44108], [46111], [48156].

See #52627.

File:
1 edited

Legend:

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

    r49927 r51154  
    900900 */
    901901function is_main_query() {
     902        global $wp_query;
     903
    902904        if ( 'pre_get_posts' === current_filter() ) {
    903                 $message = sprintf(
    904                         /* translators: 1: pre_get_posts, 2: WP_Query->is_main_query(), 3: is_main_query(), 4: Documentation URL. */
    905                         __( 'In %1$s, use the %2$s method, not the %3$s function. See %4$s.' ),
    906                         '<code>pre_get_posts</code>',
    907                         '<code>WP_Query->is_main_query()</code>',
    908                         '<code>is_main_query()</code>',
    909                         __( 'https://developer.wordpress.org/reference/functions/is_main_query/' )
     905                _doing_it_wrong(
     906                        __FUNCTION__,
     907                        sprintf(
     908                                /* translators: 1: pre_get_posts, 2: WP_Query->is_main_query(), 3: is_main_query(), 4: Documentation URL. */
     909                                __( 'In %1$s, use the %2$s method, not the %3$s function. See %4$s.' ),
     910                                '<code>pre_get_posts</code>',
     911                                '<code>WP_Query->is_main_query()</code>',
     912                                '<code>is_main_query()</code>',
     913                                __( 'https://developer.wordpress.org/reference/functions/is_main_query/' )
     914                        ),
     915                        '3.7.0'
    910916                );
    911                 _doing_it_wrong( __FUNCTION__, $message, '3.7.0' );
    912         }
    913 
    914         global $wp_query;
     917        }
     918
    915919        return $wp_query->is_main_query();
    916920}
Note: See TracChangeset for help on using the changeset viewer.