WPSEO_Metabox::add_meta_box()publicYoast 1.0

Adds the Yoast SEO meta box to the edit boxes in the edit post, page, attachment, and custom post types pages.

Метод класса: WPSEO_Metabox{}

Хуки из метода

Возвращает

null. Ничего (null).

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

$WPSEO_Metabox = new WPSEO_Metabox();
$WPSEO_Metabox->add_meta_box();

Код WPSEO_Metabox::add_meta_box() Yoast 22.4

public function add_meta_box() {
	$post_types = WPSEO_Post_Type::get_accessible_post_types();
	$post_types = array_filter( $post_types, [ $this, 'display_metabox' ] );

	if ( ! is_array( $post_types ) || $post_types === [] ) {
		return;
	}

	$product_title = $this->get_product_title();

	foreach ( $post_types as $post_type ) {
		add_filter( "postbox_classes_{$post_type}_wpseo_meta", [ $this, 'wpseo_metabox_class' ] );

		add_meta_box(
			'wpseo_meta',
			$product_title,
			[ $this, 'meta_box' ],
			$post_type,
			'normal',
			apply_filters( 'wpseo_metabox_prio', 'high' ),
			[ '__block_editor_compatible_meta_box' => true ]
		);
	}
}