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

ACF_Form_Post::add_meta_boxes() public ACF 5.7.6

Adds ACF metaboxes for the given $post_type and $post.

Ищем WP-разработчика! Фулл-тайм, удаленка, хорошая зарплата, соц. пакет. Подробности.
Компания Boosta.

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

Возвращает

null. Ничего.

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

$ACF_Form_Post = new ACF_Form_Post();
$ACF_Form_Post->add_meta_boxes( $post_type, $post );
$post_type(строка) (обязательный)
The post type.
$post(WP_Post) (обязательный)
The post being edited.

Список изменений

С версии 5.7.6 Введена.

Код ACF_Form_Post::add_meta_boxes() ACF 5.10.2

function add_meta_boxes( $post_type, $post ) {

	// Storage for localized postboxes.
	$postboxes = array();

	// Get field groups for this screen.
	$field_groups = acf_get_field_groups(
		array(
			'post_id'   => $post->ID,
			'post_type' => $post_type,
		)
	);

	// Loop over field groups.
	if ( $field_groups ) {
		foreach ( $field_groups as $field_group ) {

			// vars
			$id       = "acf-{$field_group['key']}";          // acf-group_123
			$title    = $field_group['title'];             // Group 1
			$context  = $field_group['position'];        // normal, side, acf_after_title
			$priority = 'high';                         // high, core, default, low

			// Reduce priority for sidebar metaboxes for best position.
			if ( $context == 'side' ) {
				$priority = 'core';
			}

			/**
			 * Filters the metabox priority.
			 *
			 * @date    23/06/12
			 * @since   3.1.8
			 *
			 * @param   string $priority The metabox priority (high, core, default, low).
			 * @param   array $field_group The field group array.
			 */
			$priority = apply_filters( 'acf/input/meta_box_priority', $priority, $field_group );

			// Localize data
			$postboxes[] = array(
				'id'    => $id,
				'key'   => $field_group['key'],
				'style' => $field_group['style'],
				'label' => $field_group['label_placement'],
				'edit'  => acf_get_field_group_edit_link( $field_group['ID'] ),
			);

			// Add the meta box.
			add_meta_box( $id, acf_esc_html( $title ), array( $this, 'render_meta_box' ), $post_type, $context, $priority, array( 'field_group' => $field_group ) );

		}

		// Set style from first field group.
		$this->style = acf_get_field_group_style( $field_groups[0] );

		// Localize postboxes.
		acf_localize_data(
			array(
				'postboxes' => $postboxes,
			)
		);
	}

	// remove postcustom metabox (removes expensive SQL query)
	if ( acf_get_setting( 'remove_wp_meta_box' ) ) {
		remove_meta_box( 'postcustom', false, 'normal' );
	}

	// Add hidden input fields.
	add_action( 'edit_form_after_title', array( $this, 'edit_form_after_title' ) );

	/**
	*  Fires after metaboxes have been added.
	*
	*  @date    13/12/18
	*  @since   5.8.0
	*
	*  @param   string $post_type The post type.
	*  @param   WP_Post $post The post being edited.
	*  @param   array $field_groups The field groups added.
	*/
	do_action( 'acf/add_meta_boxes', $post_type, $post, $field_groups );
}