Changeset 57663 for trunk/src/wp-includes/blocks/footnotes.php
- Timestamp:
- 02/20/2024 11:14:50 AM (10 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks/footnotes.php
r57377 r57663 69 69 */ 70 70 function register_block_core_footnotes() { 71 $post_types = get_post_types( 71 register_block_type_from_metadata( 72 __DIR__ . '/footnotes', 72 73 array( 73 'show_in_rest' => true, 74 'public' => true, 74 'render_callback' => 'render_block_core_footnotes', 75 75 ) 76 76 ); 77 } 78 add_action( 'init', 'register_block_core_footnotes' ); 79 80 81 /** 82 * Registers the footnotes meta field required for footnotes to work. 83 * 84 * @since 6.5.0 85 */ 86 function register_block_core_footnotes_post_meta() { 87 $post_types = get_post_types( array( 'show_in_rest' => true ) ); 77 88 foreach ( $post_types as $post_type ) { 78 89 // Only register the meta field if the post type supports the editor, custom fields, and revisions. 79 if ( post_type_supports( $post_type, 'editor' ) && post_type_supports( $post_type, 'custom-fields' ) && post_type_supports( $post_type, 'revisions' ) ) { 90 if ( 91 post_type_supports( $post_type, 'editor' ) && 92 post_type_supports( $post_type, 'custom-fields' ) && 93 post_type_supports( $post_type, 'revisions' ) 94 ) { 80 95 register_post_meta( 81 96 $post_type, … … 90 105 } 91 106 } 92 register_block_type_from_metadata(93 __DIR__ . '/footnotes',94 array(95 'render_callback' => 'render_block_core_footnotes',96 )97 );98 107 } 99 add_action( 'init', 'register_block_core_footnotes' ); 108 /** 109 * Most post types are registered at priority 10, so use priority 20 here in 110 * order to catch them. 111 */ 112 add_action( 'init', 'register_block_core_footnotes_post_meta', 20 ); 100 113 101 114 /**
Note: See TracChangeset
for help on using the changeset viewer.