WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Авторские Темы для WordPress
функция не описана

WPSEO_Option_Titles::enrich_defaults() public Yoast 1.0

Add dynamically created default options based on available post types and taxonomies.

{} Это метод класса: WPSEO_Option_Titles{}

Хуков нет.

Возвращает

null. Ничего.

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

$WPSEO_Option_Titles = new WPSEO_Option_Titles();
$WPSEO_Option_Titles->enrich_defaults();

Код WPSEO_Option_Titles::enrich_defaults() Yoast 16.2

<?php
public function enrich_defaults() {
	$enriched_defaults = $this->enriched_defaults;
	if ( $enriched_defaults !== null ) {
		$this->defaults += $enriched_defaults;
		return;
	}

	$enriched_defaults = [];

	/*
	 * Retrieve all the relevant post type and taxonomy arrays.
	 *
	 * WPSEO_Post_Type::get_accessible_post_types() should *not* be used here.
	 * These are the defaults and can be prepared for any public post type.
	 */
	$post_type_objects = get_post_types( [ 'public' => true ], 'objects' );

	if ( $post_type_objects ) {
		/* translators: %s expands to the name of a post type (plural). */
		$archive = sprintf( __( '%s Archive', 'wordpress-seo' ), '%%pt_plural%%' );

		foreach ( $post_type_objects as $pt ) {
			$enriched_defaults[ 'title-' . $pt->name ]                   = '%%title%% %%page%% %%sep%% %%sitename%%'; // Text field.
			$enriched_defaults[ 'metadesc-' . $pt->name ]                = ''; // Text area.
			$enriched_defaults[ 'noindex-' . $pt->name ]                 = false;
			$enriched_defaults[ 'display-metabox-pt-' . $pt->name ]      = true;
			$enriched_defaults[ 'post_types-' . $pt->name . '-maintax' ] = 0; // Select box.
			$enriched_defaults[ 'schema-page-type-' . $pt->name ]        = 'WebPage';
			$enriched_defaults[ 'schema-article-type-' . $pt->name ]     = ( YoastSEO()->helpers->schema->article->is_article_post_type( $pt->name ) ) ? 'Article' : 'None';
			$enriched_defaults[ 'social-title-' . $pt->name ]            = '%%title%%'; // Text field.
			$enriched_defaults[ 'social-description-' . $pt->name ]      = '%%excerpt%%'; // Text area.
			$enriched_defaults[ 'social-image-url-' . $pt->name ]        = ''; // Hidden input field.
			$enriched_defaults[ 'social-image-id-' . $pt->name ]         = ''; // Hidden input field.

			if ( ! $pt->_builtin && WPSEO_Post_Type::has_archive( $pt ) ) {
				$enriched_defaults[ 'title-ptarchive-' . $pt->name ]              = $archive . ' %%page%% %%sep%% %%sitename%%'; // Text field.
				$enriched_defaults[ 'metadesc-ptarchive-' . $pt->name ]           = ''; // Text area.
				$enriched_defaults[ 'bctitle-ptarchive-' . $pt->name ]            = ''; // Text field.
				$enriched_defaults[ 'noindex-ptarchive-' . $pt->name ]            = false;
				$enriched_defaults[ 'social-title-ptarchive-' . $pt->name ]       = '%%title%%'; // Text field.
				$enriched_defaults[ 'social-description-ptarchive-' . $pt->name ] = '%%excerpt%%'; // Text area.
				$enriched_defaults[ 'social-image-url-ptarchive-' . $pt->name ]   = ''; // Hidden input field.
				$enriched_defaults[ 'social-image-id-ptarchive-' . $pt->name ]    = ''; // Hidden input field.
			}
		}
	}

	$taxonomy_objects = get_taxonomies( [ 'public' => true ], 'object' );

	if ( $taxonomy_objects ) {
		/* translators: %s expands to the variable used for term title. */
		$archives = sprintf( __( '%s Archives', 'wordpress-seo' ), '%%term_title%%' );

		foreach ( $taxonomy_objects as $tax ) {
			$enriched_defaults[ 'title-tax-' . $tax->name ]           = $archives . ' %%page%% %%sep%% %%sitename%%'; // Text field.
			$enriched_defaults[ 'metadesc-tax-' . $tax->name ]        = ''; // Text area.
			$enriched_defaults[ 'display-metabox-tax-' . $tax->name ] = true;

			$enriched_defaults[ 'noindex-tax-' . $tax->name ] = ( $tax->name === 'post_format' );

			$enriched_defaults[ 'social-title-tax-' . $tax->name ]       = '%%title%%'; // Text field.
			$enriched_defaults[ 'social-description-tax-' . $tax->name ] = '%%excerpt%%'; // Text area.
			$enriched_defaults[ 'social-image-url-tax-' . $tax->name ]   = ''; // Hidden input field.
			$enriched_defaults[ 'social-image-id-tax-' . $tax->name ]    = ''; // Hidden input field.

			if ( ! $tax->_builtin ) {
				$enriched_defaults[ 'taxonomy-' . $tax->name . '-ptparent' ] = 0; // Select box;.
			}
		}
	}

	$this->enriched_defaults = $enriched_defaults;
	$this->defaults         += $enriched_defaults;
}