Yoast\WP\SEO\Schema\Infrastructure

Disable_Schema_Integration{}Yoast 1.0└─ Integration_Interface

Handles disabling schema.

Хуков нет.

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

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

Методы

  1. public static get_conditionals()
  2. public register_hooks()

Код Disable_Schema_Integration{} Yoast 27.7

class Disable_Schema_Integration implements Integration_Interface {

	/**
	 * Returns the conditionals based on which this loadable should be active.
	 *
	 * @return string[]
	 */
	public static function get_conditionals() {
		return [ Schema_Disabled_Conditional::class ];
	}

	/**
	 * Registers action hook.
	 *
	 * @return void
	 */
	public function register_hooks(): void {
		if ( ! \is_admin() ) {
			// No need to run this on admin pages, which would actually break some functionality in the schema settings page.
			// Specifically, in the schema settings page, we want to be able to understand whether schema has been disabled programmatically too.
			\add_filter( 'wpseo_json_ld_output', '__return_false' );
		}
	}
}