WPSEO_Metabox::get_metabox_script_data()publicYoast 1.0

Passes variables to js for use with the post-scraper.

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

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

Возвращает

Массив<Строку,Строку|Массив<Строку|int|true|false>|true|false|int>.

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

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

Код WPSEO_Metabox::get_metabox_script_data() Yoast 24.0

public function get_metabox_script_data() {
	$permalink = $this->get_permalink();

	$post_formatter = new WPSEO_Metabox_Formatter(
		new WPSEO_Post_Metabox_Formatter( $this->get_metabox_post(), [], $permalink )
	);

	$values = $post_formatter->get_values();
	/** This filter is documented in admin/filters/class-cornerstone-filter.php. */
	$post_types = apply_filters( 'wpseo_cornerstone_post_types', WPSEO_Post_Type::get_accessible_post_types() );
	if ( $values['cornerstoneActive'] && ! in_array( $this->get_metabox_post()->post_type, $post_types, true ) ) {
		$values['cornerstoneActive'] = false;
	}

	if ( $values['semrushIntegrationActive'] && $this->post->post_type === 'attachment' ) {
		$values['semrushIntegrationActive'] = 0;
	}

	if ( $values['wincherIntegrationActive'] && $this->post->post_type === 'attachment' ) {
		$values['wincherIntegrationActive'] = 0;
	}

	return $values;
}