ACF::register_post_types()publicACF 5.3.2

register_post_types

Registers the ACF post types.

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

Хуков нет.

Возвращает

null. Ничего.

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

$ACF = new ACF();
$ACF->register_post_types();

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

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

Код ACF::register_post_types() ACF 5.10.2

function register_post_types() {

	// Vars.
	$cap = acf_get_setting( 'capability' );

	// Register the Field Group post type.
	register_post_type(
		'acf-field-group',
		array(
			'labels'          => array(
				'name'               => __( 'Field Groups', 'acf' ),
				'singular_name'      => __( 'Field Group', 'acf' ),
				'add_new'            => __( 'Add New', 'acf' ),
				'add_new_item'       => __( 'Add New Field Group', 'acf' ),
				'edit_item'          => __( 'Edit Field Group', 'acf' ),
				'new_item'           => __( 'New Field Group', 'acf' ),
				'view_item'          => __( 'View Field Group', 'acf' ),
				'search_items'       => __( 'Search Field Groups', 'acf' ),
				'not_found'          => __( 'No Field Groups found', 'acf' ),
				'not_found_in_trash' => __( 'No Field Groups found in Trash', 'acf' ),
			),
			'public'          => false,
			'hierarchical'    => true,
			'show_ui'         => true,
			'show_in_menu'    => false,
			'_builtin'        => false,
			'capability_type' => 'post',
			'capabilities'    => array(
				'edit_post'    => $cap,
				'delete_post'  => $cap,
				'edit_posts'   => $cap,
				'delete_posts' => $cap,
			),
			'supports'        => array( 'title' ),
			'rewrite'         => false,
			'query_var'       => false,
		)
	);

	// Register the Field post type.
	register_post_type(
		'acf-field',
		array(
			'labels'          => array(
				'name'               => __( 'Fields', 'acf' ),
				'singular_name'      => __( 'Field', 'acf' ),
				'add_new'            => __( 'Add New', 'acf' ),
				'add_new_item'       => __( 'Add New Field', 'acf' ),
				'edit_item'          => __( 'Edit Field', 'acf' ),
				'new_item'           => __( 'New Field', 'acf' ),
				'view_item'          => __( 'View Field', 'acf' ),
				'search_items'       => __( 'Search Fields', 'acf' ),
				'not_found'          => __( 'No Fields found', 'acf' ),
				'not_found_in_trash' => __( 'No Fields found in Trash', 'acf' ),
			),
			'public'          => false,
			'hierarchical'    => true,
			'show_ui'         => false,
			'show_in_menu'    => false,
			'_builtin'        => false,
			'capability_type' => 'post',
			'capabilities'    => array(
				'edit_post'    => $cap,
				'delete_post'  => $cap,
				'edit_posts'   => $cap,
				'delete_posts' => $cap,
			),
			'supports'        => array( 'title' ),
			'rewrite'         => false,
			'query_var'       => false,
		)
	);
}