: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if ( nonces.replace.metabox_loader_nonce && window._wpMetaBoxUrl && wp.url ) {
window._wpMetaBoxUrl= wp.url.addQueryArgs( window._wpMetaBoxUrl, { 'meta-box-loader-nonce': nonces.replace.metabox_loader_nonce } );
if ( nonces.replace._wpnonce ) {
$( '#_wpnonce' ).val( nonces.replace._wpnonce );
wp_add_inline_script( 'heartbeat', $script );
$wp_meta_boxes = $_original_meta_boxes;
* Renders the hidden form required for the meta boxes form.
* @param WP_Post $post Current post object.
function the_block_editor_meta_box_post_form_hidden_fields( $post ) {
if ( 'auto-draft' === $post->post_status ) {
$form_extra .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />";
$form_action = 'editpost';
$nonce_action = 'update-post_' . $post->ID;
$form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr( $post->ID ) . "' />";
$referer = wp_get_referer();
$current_user = wp_get_current_user();
$user_id = $current_user->ID;
wp_nonce_field( $nonce_action );
* Some meta boxes hook into these actions to add hidden input fields in the classic post form.
* For backward compatibility, we can capture the output from these actions,
* and extract the hidden input fields.
/** This filter is documented in wp-admin/edit-form-advanced.php */
do_action( 'edit_form_after_title', $post );
/** This filter is documented in wp-admin/edit-form-advanced.php */
do_action( 'edit_form_advanced', $post );
$classic_output = ob_get_clean();
$classic_elements = wp_html_split( $classic_output );
foreach ( $classic_elements as $element ) {
if ( ! str_starts_with( $element, '<input ' ) ) {
if ( preg_match( '/\stype=[\'"]hidden[\'"]\s/', $element ) ) {
<input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_id; ?>" />
<input type="hidden" id="hiddenaction" name="action" value="<?php echo esc_attr( $form_action ); ?>" />
<input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr( $form_action ); ?>" />
<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr( $post->post_type ); ?>" />
<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr( $post->post_status ); ?>" />
<input type="hidden" id="referredby" name="referredby" value="<?php echo $referer ? esc_url( $referer ) : ''; ?>" />
if ( 'draft' !== get_post_status( $post ) ) {
wp_original_referer_field( true, 'previous' );
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
// Permalink title nonce.
wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false );
* Adds hidden input fields to the meta box save form.
* Hook into this action to print `<input type="hidden" ... />` fields, which will be POSTed back to
* the server when meta boxes are saved.
* @param WP_Post $post The post that is being edited.
do_action( 'block_editor_meta_box_hidden_fields', $post );
* Disables block editor for wp_navigation type posts so they can be managed via the UI.
* @param bool $value Whether the CPT supports block editor or not.
* @param string $post_type Post type.
* @return bool Whether the block editor should be disabled or not.
function _disable_block_editor_for_navigation_post_type( $value, $post_type ) {
if ( 'wp_navigation' === $post_type ) {
* This callback disables the content editor for wp_navigation type posts.
* Content editor cannot handle wp_navigation type posts correctly.
* We cannot disable the "editor" feature in the wp_navigation's CPT definition
* because it disables the ability to save navigation blocks via REST API.
* @param WP_Post $post An instance of WP_Post class.
function _disable_content_editor_for_navigation_post_type( $post ) {
$post_type = get_post_type( $post );
if ( 'wp_navigation' !== $post_type ) {
remove_post_type_support( $post_type, 'editor' );
* This callback enables content editor for wp_navigation type posts.
* We need to enable it back because we disable it to hide
* the content editor for wp_navigation type posts.
* @see _disable_content_editor_for_navigation_post_type
* @param WP_Post $post An instance of WP_Post class.
function _enable_content_editor_for_navigation_post_type( $post ) {
$post_type = get_post_type( $post );
if ( 'wp_navigation' !== $post_type ) {
add_post_type_support( $post_type, 'editor' );