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

WPSEO_Meta::get_meta_field_defs() public Yoast 1.0

Retrieve the meta box form field definitions for the given tab and post type.

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

Хуки из метода
Возвращает

Массив. Array containing the meta box field definitions.

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

$result = WPSEO_Meta::get_meta_field_defs( $tab, $post_type );
$tab(строка) (обязательный)
Tab for which to retrieve the field definitions.
$post_type(строка)
Post type of the current post.
По умолчанию: 'post'

Код WPSEO_Meta::get_meta_field_defs() Yoast 17.3

public static function get_meta_field_defs( $tab, $post_type = 'post' ) {
	if ( ! isset( self::$meta_fields[ $tab ] ) ) {
		return [];
	}

	$field_defs = self::$meta_fields[ $tab ];

	switch ( $tab ) {
		case 'non-form':
			// Prevent non-form fields from being passed to forms.
			$field_defs = [];
			break;

		case 'advanced':
			global $post;

			if ( ! WPSEO_Capability_Utils::current_user_can( 'wpseo_edit_advanced_metadata' ) && WPSEO_Options::get( 'disableadvanced_meta' ) ) {
				return [];
			}

			$post_type = '';
			if ( isset( $post->post_type ) ) {
				$post_type = $post->post_type;
			}
			elseif ( ! isset( $post->post_type ) && isset( $_GET['post_type'] ) ) {
				$post_type = sanitize_text_field( $_GET['post_type'] );
			}

			if ( $post_type === '' ) {
				return [];
			}

			/* Adjust the no-index text strings based on the post type. */
			$post_type_object = get_post_type_object( $post_type );

			$field_defs['meta-robots-noindex']['title']        = sprintf( $field_defs['meta-robots-noindex']['title'], $post_type_object->labels->singular_name );
			$field_defs['meta-robots-noindex']['options']['0'] = sprintf( $field_defs['meta-robots-noindex']['options']['0'], ( ( WPSEO_Options::get( 'noindex-' . $post_type, false ) === true ) ? $field_defs['meta-robots-noindex']['options']['1'] : $field_defs['meta-robots-noindex']['options']['2'] ), $post_type_object->label );
			$field_defs['meta-robots-nofollow']['title']       = sprintf( $field_defs['meta-robots-nofollow']['title'], $post_type_object->labels->singular_name );

			/* Don't show the breadcrumb title field if breadcrumbs aren't enabled. */
			if ( WPSEO_Options::get( 'breadcrumbs-enable', false ) !== true && ! current_theme_supports( 'yoast-seo-breadcrumbs' ) ) {
				unset( $field_defs['bctitle'] );
			}

			global $post;

			if ( empty( $post->ID ) || ( ! empty( $post->ID ) && self::get_value( 'redirect', $post->ID ) === '' ) ) {
				unset( $field_defs['redirect'] );
			}
			break;

		case 'schema':
			if ( ! WPSEO_Capability_Utils::current_user_can( 'wpseo_edit_advanced_metadata' ) && WPSEO_Options::get( 'disableadvanced_meta' ) ) {
				return [];
			}

			$field_defs['schema_page_type']['default'] = WPSEO_Options::get( 'schema-page-type-' . $post_type );

			$article_helper = new Article_Helper();
			if ( $post_type !== 'page' && $article_helper->is_author_supported( $post_type ) ) {
				$field_defs['schema_article_type']['default'] = WPSEO_Options::get( 'schema-article-type-' . $post_type );
			}
			else {
				unset( $field_defs['schema_article_type'] );
			}

			break;
	}

	/**
	 * Filter the WPSEO metabox form field definitions for a tab.
	 * {tab} can be 'general', 'advanced' or 'social'.
	 *
	 * @param array  $field_defs Metabox form field definitions.
	 * @param string $post_type  Post type of the post the metabox is for, defaults to 'post'.
	 *
	 * @return array
	 */
	return apply_filters( 'wpseo_metabox_entries_' . $tab, $field_defs, $post_type );
}