register_block_core_footnotes_post_meta()WP 6.5.0

Registers the footnotes meta field required for footnotes to work.

Хуков нет.

Возвращает

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

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

register_block_core_footnotes_post_meta();

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

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

Код register_block_core_footnotes_post_meta() WP 6.7.1

function register_block_core_footnotes_post_meta() {
	$post_types = get_post_types( array( 'show_in_rest' => true ) );
	foreach ( $post_types as $post_type ) {
		// Only register the meta field if the post type supports the editor, custom fields, and revisions.
		if (
			post_type_supports( $post_type, 'editor' ) &&
			post_type_supports( $post_type, 'custom-fields' ) &&
			post_type_supports( $post_type, 'revisions' )
		) {
			register_post_meta(
				$post_type,
				'footnotes',
				array(
					'show_in_rest'      => true,
					'single'            => true,
					'type'              => 'string',
					'revisions_enabled' => true,
				)
			);
		}
	}
}