Yoast\WP\SEO\Conditionals\Admin

Yoast_Admin_Conditional{}Yoast 1.0└─ Conditional

Conditional that is only met when on a Yoast SEO admin page.

Хуков нет.

Использование

$Yoast_Admin_Conditional = new Yoast_Admin_Conditional();
// use class methods

Методы

  1. public __construct( Current_Page_Helper $current_page_helper )
  2. public is_met()

Код Yoast_Admin_Conditional{} Yoast 26.9

class Yoast_Admin_Conditional implements Conditional {

	/**
	 * Holds the Current_Page_Helper.
	 *
	 * @var Current_Page_Helper
	 */
	private $current_page_helper;

	/**
	 * Constructs the conditional.
	 *
	 * @param Current_Page_Helper $current_page_helper The current page helper.
	 */
	public function __construct( Current_Page_Helper $current_page_helper ) {
		$this->current_page_helper = $current_page_helper;
	}

	/**
	 * Returns `true` when on the admin dashboard, update or Yoast SEO pages.
	 *
	 * @return bool `true` when on the admin dashboard, update or Yoast SEO pages.
	 */
	public function is_met() {
		if ( ! \is_admin() ) {
			return false;
		}

		return $this->current_page_helper->is_yoast_seo_page();
	}
}