Yoast\WP\SEO\Actions\Importing\Aioseo

Aioseo_Posttype_Defaults_Settings_Importing_Action::build_mapping()protectedYoast 1.0

Builds the mapping that ties AOISEO option keys with Yoast ones and their data transformation method.

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

Хуков нет.

Возвращает

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

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->build_mapping();

Код Aioseo_Posttype_Defaults_Settings_Importing_Action::build_mapping() Yoast 22.3

protected function build_mapping() {
	$post_type_objects = \get_post_types( [ 'public' => true ], 'objects' );

	foreach ( $post_type_objects as $pt ) {
		// Use all the custom post types that are public.
		$this->aioseo_options_to_yoast_map[ '/' . $pt->name . '/title' ]                       = [
			'yoast_name'       => 'title-' . $pt->name,
			'transform_method' => 'simple_import',
		];
		$this->aioseo_options_to_yoast_map[ '/' . $pt->name . '/metaDescription' ]             = [
			'yoast_name'       => 'metadesc-' . $pt->name,
			'transform_method' => 'simple_import',
		];
		$this->aioseo_options_to_yoast_map[ '/' . $pt->name . '/advanced/showMetaBox' ]        = [
			'yoast_name'       => 'display-metabox-pt-' . $pt->name,
			'transform_method' => 'simple_boolean_import',
		];
		$this->aioseo_options_to_yoast_map[ '/' . $pt->name . '/advanced/robotsMeta/noindex' ] = [
			'yoast_name'       => 'noindex-' . $pt->name,
			'transform_method' => 'import_noindex',
			'type'             => 'postTypes',
			'subtype'          => $pt->name,
			'option_name'      => 'aioseo_options_dynamic',
		];

		if ( $pt->name === 'attachment' ) {
			$this->aioseo_options_to_yoast_map['/attachment/redirectAttachmentUrls'] = [
				'yoast_name'       => 'disable-attachment',
				'transform_method' => 'import_redirect_attachment',
			];
		}
	}
}