| @@ -101,17 +101,8 @@ | ||
| 101 | 101 | ]; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | - * Determines whether the current request is a REST request. | |
| 106 | - * | |
| 107 | - * @return bool Whether the request is a REST request. | |
| 108 | - */ | |
| 109 | - public function is_rest_request() { | |
| 110 | - return \defined( 'REST_REQUEST' ) && \REST_REQUEST; | |
| 111 | - } | |
| 112 | - | |
| 113 | - /** | |
| 114 | 105 | * Sends the keyphrases associated with the post to Wincher for automatic tracking. |
| 115 | 106 | * |
| 116 | 107 | * @param WP_Post $post The post to extract the keyphrases from. |
| 117 | 108 | * |
| @@ -152,9 +143,9 @@ | ||
| 152 | 143 | * |
| 153 | 144 | * @return void |
| 154 | 145 | */ |
| 155 | 146 | public function track_after_post_request( $post_id, $post ) { |
| 156 | - if ( $this->is_rest_request() ) { | |
| 147 | + if ( \wp_is_serving_rest_request() ) { | |
| 157 | 148 | return; |
| 158 | 149 | } |
| 159 | 150 | |
| 160 | 151 | $this->track_request( $post ); |