| @@ -103,11 +103,15 @@ | ||
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | 105 | * Determines whether the current request is a REST request. |
| 106 | 106 | * |
| 107 | + * @deprecated 23.6 | |
| 108 | + * @codeCoverageIgnore | |
| 109 | + * | |
| 107 | 110 | * @return bool Whether the request is a REST request. |
| 108 | 111 | */ |
| 109 | 112 | public function is_rest_request() { |
| 113 | + \_deprecated_function( __METHOD__, 'Yoast SEO 23.6', 'wp_is_serving_rest_request' ); | |
| 110 | 114 | return \defined( 'REST_REQUEST' ) && \REST_REQUEST; |
| 111 | 115 | } |
| 112 | 116 | |
| 113 | 117 | /** |
| @@ -117,9 +121,9 @@ | ||
| 117 | 121 | * |
| 118 | 122 | * @return void |
| 119 | 123 | */ |
| 120 | 124 | public function track_request( $post ) { |
| 121 | - if ( ! $post instanceof \WP_Post ) { | |
| 125 | + if ( ! $post instanceof WP_Post ) { | |
| 122 | 126 | return; |
| 123 | 127 | } |
| 124 | 128 | |
| 125 | 129 | // Filter out empty entries. |
| @@ -152,9 +156,9 @@ | ||
| 152 | 156 | * |
| 153 | 157 | * @return void |
| 154 | 158 | */ |
| 155 | 159 | public function track_after_post_request( $post_id, $post ) { |
| 156 | - if ( $this->is_rest_request() ) { | |
| 160 | + if ( \wp_is_serving_rest_request() ) { | |
| 157 | 161 | return; |
| 158 | 162 | } |
| 159 | 163 | |
| 160 | 164 | $this->track_request( $post ); |