Make WordPress Core

Ticket #34373: 34373.1.diff

File 34373.1.diff, 754 bytes (added by danielbachhuber, 8 years ago)

Define WP_Query::$is_rest and WP_Query::is_rest()

  • src/wp-includes/query.php

    diff --git src/wp-includes/query.php src/wp-includes/query.php
    index 2a77cc4..a9009ea 100644
    class WP_Query { 
    12301230        public $is_embed = false;
    12311231
    12321232        /**
     1233         * True if query is within the context of a REST request.
     1234         *
     1235         * @since 4.4.0
     1236         * @access public
     1237         * @var bool
     1238         */
     1239        public $is_rest = false;
     1240
     1241        /**
    12331242         * Set if query is within comments popup window.
    12341243         *
    12351244         * @since 1.5.0
    class WP_Query { 
    47024711        }
    47034712
    47044713        /**
     4714         * Is the query within the context of a REST request?
     4715         *
     4716         * @since 4.4.0
     4717         *
     4718         * @return bool
     4719         */
     4720        public function is_rest() {
     4721                return (bool) $this->is_rest;
     4722        }
     4723
     4724        /**
    47054725         * Is the query the main query?
    47064726         *
    47074727         * @since 3.3.0