← All changes
|
src/conditionals/yoast-admin-and-dashboard-conditional.php
+6
-1
18.2
→
trunk
View file →
| @@ -1,5 +1,5 @@ | ||
| 1 | -<?php | |
| 1 | +<?php // phpcs:ignore Yoast.Files.FileName.InvalidClassFileName -- Reason: this explicitly concerns the Yoast admin and dashboard. | |
| 2 | 2 | |
| 3 | 3 | namespace Yoast\WP\SEO\Conditionals; |
| 4 | 4 | |
| 5 | 5 | /** |
| @@ -13,8 +13,13 @@ | ||
| 13 | 13 | * @return bool `true` when on the admin dashboard, update or Yoast SEO pages. |
| 14 | 14 | */ |
| 15 | 15 | public function is_met() { |
| 16 | 16 | global $pagenow; |
| 17 | + | |
| 18 | + // Bail out early if we're not on the front-end. | |
| 19 | + if ( ! \is_admin() ) { | |
| 20 | + return false; | |
| 21 | + } | |
| 17 | 22 | |
| 18 | 23 | // Do not output on plugin / theme upgrade pages or when WordPress is upgrading. |
| 19 | 24 | if ( ( \defined( 'IFRAME_REQUEST' ) && \IFRAME_REQUEST ) || $this->on_upgrade_page() || \wp_installing() ) { |
| 20 | 25 | return false; |