Edit File by line
/home/zeestwma/redstone.../wp-admin
File: edit-form-blocks.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* The block editor page.
[2] Fix | Delete
*
[3] Fix | Delete
* @since 5.0.0
[4] Fix | Delete
*
[5] Fix | Delete
* @package WordPress
[6] Fix | Delete
* @subpackage Administration
[7] Fix | Delete
*/
[8] Fix | Delete
[9] Fix | Delete
// Don't load directly.
[10] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[11] Fix | Delete
die( '-1' );
[12] Fix | Delete
}
[13] Fix | Delete
[14] Fix | Delete
/**
[15] Fix | Delete
* @global string $post_type Global post type.
[16] Fix | Delete
* @global WP_Post_Type $post_type_object Global post type object.
[17] Fix | Delete
* @global WP_Post $post Global post object.
[18] Fix | Delete
* @global string $title The title of the current screen.
[19] Fix | Delete
* @global array $wp_meta_boxes Global meta box state.
[20] Fix | Delete
*/
[21] Fix | Delete
global $post_type, $post_type_object, $post, $title, $wp_meta_boxes;
[22] Fix | Delete
[23] Fix | Delete
$block_editor_context = new WP_Block_Editor_Context( array( 'post' => $post ) );
[24] Fix | Delete
[25] Fix | Delete
// Flag that we're loading the block editor.
[26] Fix | Delete
$current_screen = get_current_screen();
[27] Fix | Delete
$current_screen->is_block_editor( true );
[28] Fix | Delete
[29] Fix | Delete
// Default to is-fullscreen-mode to avoid jumps in the UI.
[30] Fix | Delete
add_filter(
[31] Fix | Delete
'admin_body_class',
[32] Fix | Delete
static function ( $classes ) {
[33] Fix | Delete
return "$classes is-fullscreen-mode";
[34] Fix | Delete
}
[35] Fix | Delete
);
[36] Fix | Delete
[37] Fix | Delete
/*
[38] Fix | Delete
* Emoji replacement is disabled for now, until it plays nicely with React.
[39] Fix | Delete
*/
[40] Fix | Delete
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
[41] Fix | Delete
[42] Fix | Delete
/*
[43] Fix | Delete
* Block editor implements its own Options menu for toggling Document Panels.
[44] Fix | Delete
*/
[45] Fix | Delete
add_filter( 'screen_options_show_screen', '__return_false' );
[46] Fix | Delete
[47] Fix | Delete
wp_enqueue_script( 'heartbeat' );
[48] Fix | Delete
wp_enqueue_script( 'wp-edit-post' );
[49] Fix | Delete
[50] Fix | Delete
$rest_path = rest_get_route_for_post( $post );
[51] Fix | Delete
[52] Fix | Delete
$active_theme = get_stylesheet();
[53] Fix | Delete
$global_styles_endpoint_context = current_user_can( 'edit_theme_options' ) ? 'edit' : 'view';
[54] Fix | Delete
$template_lookup_slug = 'page' === $post->post_type ? 'page' : 'single-' . $post->post_type;
[55] Fix | Delete
if ( ! empty( $post->post_name ) ) {
[56] Fix | Delete
$template_lookup_slug .= '-' . $post->post_name;
[57] Fix | Delete
}
[58] Fix | Delete
// Preload common data.
[59] Fix | Delete
$preload_paths = array(
[60] Fix | Delete
'/wp/v2/types?context=view',
[61] Fix | Delete
'/wp/v2/taxonomies?context=view',
[62] Fix | Delete
add_query_arg( 'context', 'edit', $rest_path ),
[63] Fix | Delete
sprintf( '/wp/v2/types/%s?context=edit', $post_type ),
[64] Fix | Delete
'/wp/v2/users/me',
[65] Fix | Delete
array( rest_get_route_for_post_type_items( 'attachment' ), 'OPTIONS' ),
[66] Fix | Delete
array( rest_get_route_for_post_type_items( 'page' ), 'OPTIONS' ),
[67] Fix | Delete
array( rest_get_route_for_post_type_items( 'wp_block' ), 'OPTIONS' ),
[68] Fix | Delete
array( rest_get_route_for_post_type_items( 'wp_template' ), 'OPTIONS' ),
[69] Fix | Delete
sprintf( '%s/autosaves?context=edit', $rest_path ),
[70] Fix | Delete
'/wp/v2/settings',
[71] Fix | Delete
array( '/wp/v2/settings', 'OPTIONS' ),
[72] Fix | Delete
'/wp/v2/global-styles/themes/' . $active_theme . '?context=view',
[73] Fix | Delete
'/wp/v2/global-styles/themes/' . $active_theme . '/variations?context=view',
[74] Fix | Delete
'/wp/v2/themes?context=edit&status=active',
[75] Fix | Delete
array( '/wp/v2/global-styles/' . WP_Theme_JSON_Resolver::get_user_global_styles_post_id(), 'OPTIONS' ),
[76] Fix | Delete
/*
[77] Fix | Delete
* Preload the global styles path with the correct context based on user caps.
[78] Fix | Delete
* NOTE: There is an equivalent conditional check in the client-side code to fetch
[79] Fix | Delete
* the global styles entity using the appropriate context value.
[80] Fix | Delete
* See the call to `canUser()`, under `useGlobalStylesUserConfig()` in `packages/edit-site/src/components/use-global-styles-user-config/index.js`.
[81] Fix | Delete
* Please ensure that the equivalent check is kept in sync with this preload path.
[82] Fix | Delete
*/
[83] Fix | Delete
'/wp/v2/global-styles/' . WP_Theme_JSON_Resolver::get_user_global_styles_post_id() . '?context=' . $global_styles_endpoint_context,
[84] Fix | Delete
// Used by getBlockPatternCategories in useBlockEditorSettings.
[85] Fix | Delete
'/wp/v2/block-patterns/categories',
[86] Fix | Delete
// @see packages/core-data/src/entities.js
[87] Fix | Delete
'/?_fields=' . implode(
[88] Fix | Delete
',',
[89] Fix | Delete
array(
[90] Fix | Delete
'description',
[91] Fix | Delete
'gmt_offset',
[92] Fix | Delete
'home',
[93] Fix | Delete
'name',
[94] Fix | Delete
'site_icon',
[95] Fix | Delete
'site_icon_url',
[96] Fix | Delete
'site_logo',
[97] Fix | Delete
'timezone_string',
[98] Fix | Delete
'url',
[99] Fix | Delete
'page_for_posts',
[100] Fix | Delete
'page_on_front',
[101] Fix | Delete
'show_on_front',
[102] Fix | Delete
)
[103] Fix | Delete
),
[104] Fix | Delete
$paths[] = add_query_arg(
[105] Fix | Delete
'slug',
[106] Fix | Delete
// @see https://github.com/WordPress/gutenberg/blob/e093fefd041eb6cc4a4e7f67b92ab54fd75c8858/packages/core-data/src/private-selectors.ts#L244-L254
[107] Fix | Delete
$template_lookup_slug,
[108] Fix | Delete
'/wp/v2/templates/lookup'
[109] Fix | Delete
),
[110] Fix | Delete
);
[111] Fix | Delete
[112] Fix | Delete
block_editor_rest_api_preload( $preload_paths, $block_editor_context );
[113] Fix | Delete
[114] Fix | Delete
wp_add_inline_script(
[115] Fix | Delete
'wp-blocks',
[116] Fix | Delete
sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( $post ), JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ),
[117] Fix | Delete
'after'
[118] Fix | Delete
);
[119] Fix | Delete
[120] Fix | Delete
/*
[121] Fix | Delete
* Assign initial edits, if applicable. These are not initially assigned to the persisted post,
[122] Fix | Delete
* but should be included in its save payload.
[123] Fix | Delete
*/
[124] Fix | Delete
$initial_edits = array();
[125] Fix | Delete
$is_new_post = false;
[126] Fix | Delete
if ( 'auto-draft' === $post->post_status ) {
[127] Fix | Delete
$is_new_post = true;
[128] Fix | Delete
// Override "(Auto Draft)" new post default title with empty string, or filtered value.
[129] Fix | Delete
if ( post_type_supports( $post->post_type, 'title' ) ) {
[130] Fix | Delete
$initial_edits['title'] = $post->post_title;
[131] Fix | Delete
}
[132] Fix | Delete
[133] Fix | Delete
if ( post_type_supports( $post->post_type, 'editor' ) ) {
[134] Fix | Delete
$initial_edits['content'] = $post->post_content;
[135] Fix | Delete
}
[136] Fix | Delete
[137] Fix | Delete
if ( post_type_supports( $post->post_type, 'excerpt' ) ) {
[138] Fix | Delete
$initial_edits['excerpt'] = $post->post_excerpt;
[139] Fix | Delete
}
[140] Fix | Delete
}
[141] Fix | Delete
[142] Fix | Delete
// Preload server-registered block schemas.
[143] Fix | Delete
wp_add_inline_script(
[144] Fix | Delete
'wp-blocks',
[145] Fix | Delete
'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings(), JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) . ');'
[146] Fix | Delete
);
[147] Fix | Delete
[148] Fix | Delete
// Preload server-registered block bindings sources.
[149] Fix | Delete
$registered_sources = get_all_registered_block_bindings_sources();
[150] Fix | Delete
if ( ! empty( $registered_sources ) ) {
[151] Fix | Delete
$filtered_sources = array();
[152] Fix | Delete
foreach ( $registered_sources as $source ) {
[153] Fix | Delete
$filtered_sources[] = array(
[154] Fix | Delete
'name' => $source->name,
[155] Fix | Delete
'label' => $source->label,
[156] Fix | Delete
'usesContext' => $source->uses_context,
[157] Fix | Delete
);
[158] Fix | Delete
}
[159] Fix | Delete
$script = sprintf( 'for ( const source of %s ) { wp.blocks.registerBlockBindingsSource( source ); }', wp_json_encode( $filtered_sources, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) );
[160] Fix | Delete
wp_add_inline_script(
[161] Fix | Delete
'wp-blocks',
[162] Fix | Delete
$script
[163] Fix | Delete
);
[164] Fix | Delete
}
[165] Fix | Delete
[166] Fix | Delete
// Get admin url for handling meta boxes.
[167] Fix | Delete
$meta_box_url = admin_url( 'post.php' );
[168] Fix | Delete
$meta_box_url = add_query_arg(
[169] Fix | Delete
array(
[170] Fix | Delete
'post' => $post->ID,
[171] Fix | Delete
'action' => 'edit',
[172] Fix | Delete
'meta-box-loader' => true,
[173] Fix | Delete
'meta-box-loader-nonce' => wp_create_nonce( 'meta-box-loader' ),
[174] Fix | Delete
),
[175] Fix | Delete
$meta_box_url
[176] Fix | Delete
);
[177] Fix | Delete
wp_add_inline_script(
[178] Fix | Delete
'wp-editor',
[179] Fix | Delete
sprintf( 'var _wpMetaBoxUrl = %s;', wp_json_encode( $meta_box_url, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ),
[180] Fix | Delete
'before'
[181] Fix | Delete
);
[182] Fix | Delete
[183] Fix | Delete
// Set Heartbeat interval to 10 seconds, used to refresh post locks.
[184] Fix | Delete
wp_add_inline_script(
[185] Fix | Delete
'heartbeat',
[186] Fix | Delete
'jQuery( function() {
[187] Fix | Delete
wp.heartbeat.interval( 10 );
[188] Fix | Delete
} );',
[189] Fix | Delete
'after'
[190] Fix | Delete
);
[191] Fix | Delete
[192] Fix | Delete
/*
[193] Fix | Delete
* Get all available templates for the post/page attributes meta-box.
[194] Fix | Delete
* The "Default template" array element should only be added if the array is
[195] Fix | Delete
* not empty so we do not trigger the template select element without any options
[196] Fix | Delete
* besides the default value.
[197] Fix | Delete
*/
[198] Fix | Delete
$available_templates = wp_get_theme()->get_page_templates( get_post( $post->ID ) );
[199] Fix | Delete
$available_templates = ! empty( $available_templates ) ? array_replace(
[200] Fix | Delete
array(
[201] Fix | Delete
/** This filter is documented in wp-admin/includes/meta-boxes.php */
[202] Fix | Delete
'' => apply_filters( 'default_page_template_title', __( 'Default template' ), 'rest-api' ),
[203] Fix | Delete
),
[204] Fix | Delete
$available_templates
[205] Fix | Delete
) : $available_templates;
[206] Fix | Delete
[207] Fix | Delete
// Lock settings.
[208] Fix | Delete
$user_id = wp_check_post_lock( $post->ID );
[209] Fix | Delete
if ( $user_id ) {
[210] Fix | Delete
$locked = false;
[211] Fix | Delete
[212] Fix | Delete
/** This filter is documented in wp-admin/includes/post.php */
[213] Fix | Delete
if ( apply_filters( 'show_post_locked_dialog', true, $post, $user_id ) ) {
[214] Fix | Delete
$locked = true;
[215] Fix | Delete
}
[216] Fix | Delete
[217] Fix | Delete
$user_details = null;
[218] Fix | Delete
if ( $locked ) {
[219] Fix | Delete
$user = get_userdata( $user_id );
[220] Fix | Delete
$user_details = array(
[221] Fix | Delete
'name' => $user->display_name,
[222] Fix | Delete
);
[223] Fix | Delete
[224] Fix | Delete
if ( get_option( 'show_avatars' ) ) {
[225] Fix | Delete
$user_details['avatar'] = get_avatar_url( $user_id, array( 'size' => 128 ) );
[226] Fix | Delete
}
[227] Fix | Delete
}
[228] Fix | Delete
[229] Fix | Delete
$lock_details = array(
[230] Fix | Delete
'isLocked' => $locked,
[231] Fix | Delete
'user' => $user_details,
[232] Fix | Delete
);
[233] Fix | Delete
} else {
[234] Fix | Delete
// Lock the post.
[235] Fix | Delete
$active_post_lock = wp_set_post_lock( $post->ID );
[236] Fix | Delete
if ( $active_post_lock ) {
[237] Fix | Delete
$active_post_lock = esc_attr( implode( ':', $active_post_lock ) );
[238] Fix | Delete
}
[239] Fix | Delete
[240] Fix | Delete
$lock_details = array(
[241] Fix | Delete
'isLocked' => false,
[242] Fix | Delete
'activePostLock' => $active_post_lock,
[243] Fix | Delete
);
[244] Fix | Delete
}
[245] Fix | Delete
[246] Fix | Delete
/**
[247] Fix | Delete
* Filters the body placeholder text.
[248] Fix | Delete
*
[249] Fix | Delete
* @since 5.0.0
[250] Fix | Delete
* @since 5.8.0 Changed the default placeholder text.
[251] Fix | Delete
*
[252] Fix | Delete
* @param string $text Placeholder text. Default 'Type / to choose a block'.
[253] Fix | Delete
* @param WP_Post $post Post object.
[254] Fix | Delete
*/
[255] Fix | Delete
$body_placeholder = apply_filters( 'write_your_story', __( 'Type / to choose a block' ), $post );
[256] Fix | Delete
[257] Fix | Delete
$editor_settings = array(
[258] Fix | Delete
'availableTemplates' => $available_templates,
[259] Fix | Delete
'disablePostFormats' => ! current_theme_supports( 'post-formats' ),
[260] Fix | Delete
/** This filter is documented in wp-admin/edit-form-advanced.php */
[261] Fix | Delete
'titlePlaceholder' => apply_filters( 'enter_title_here', __( 'Add title' ), $post ),
[262] Fix | Delete
'bodyPlaceholder' => $body_placeholder,
[263] Fix | Delete
'autosaveInterval' => AUTOSAVE_INTERVAL,
[264] Fix | Delete
'richEditingEnabled' => user_can_richedit(),
[265] Fix | Delete
'postLock' => $lock_details,
[266] Fix | Delete
'postLockUtils' => array(
[267] Fix | Delete
'nonce' => wp_create_nonce( 'lock-post_' . $post->ID ),
[268] Fix | Delete
'unlockNonce' => wp_create_nonce( 'update-post_' . $post->ID ),
[269] Fix | Delete
'ajaxUrl' => admin_url( 'admin-ajax.php' ),
[270] Fix | Delete
),
[271] Fix | Delete
'supportsLayout' => wp_theme_has_theme_json(),
[272] Fix | Delete
'supportsTemplateMode' => current_theme_supports( 'block-templates' ),
[273] Fix | Delete
[274] Fix | Delete
// Whether or not to load the 'postcustom' meta box is stored as a user meta
[275] Fix | Delete
// field so that we're not always loading its assets.
[276] Fix | Delete
'enableCustomFields' => (bool) get_user_meta( get_current_user_id(), 'enable_custom_fields', true ),
[277] Fix | Delete
);
[278] Fix | Delete
[279] Fix | Delete
// Add additional back-compat patterns registered by `current_screen` et al.
[280] Fix | Delete
$editor_settings['__experimentalAdditionalBlockPatterns'] = WP_Block_Patterns_Registry::get_instance()->get_all_registered( true );
[281] Fix | Delete
$editor_settings['__experimentalAdditionalBlockPatternCategories'] = WP_Block_Pattern_Categories_Registry::get_instance()->get_all_registered( true );
[282] Fix | Delete
[283] Fix | Delete
$autosave = wp_get_post_autosave( $post->ID );
[284] Fix | Delete
if ( $autosave ) {
[285] Fix | Delete
if ( mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) {
[286] Fix | Delete
$editor_settings['autosave'] = array(
[287] Fix | Delete
'editLink' => get_edit_post_link( $autosave->ID ),
[288] Fix | Delete
);
[289] Fix | Delete
} else {
[290] Fix | Delete
wp_delete_post_revision( $autosave->ID );
[291] Fix | Delete
}
[292] Fix | Delete
}
[293] Fix | Delete
[294] Fix | Delete
if ( ! empty( $post_type_object->template ) ) {
[295] Fix | Delete
$editor_settings['template'] = $post_type_object->template;
[296] Fix | Delete
$editor_settings['templateLock'] = ! empty( $post_type_object->template_lock ) ? $post_type_object->template_lock : false;
[297] Fix | Delete
}
[298] Fix | Delete
[299] Fix | Delete
// If there's no template set on a new post, use the post format, instead.
[300] Fix | Delete
if ( $is_new_post && ! isset( $editor_settings['template'] ) && 'post' === $post->post_type ) {
[301] Fix | Delete
$post_format = get_post_format( $post );
[302] Fix | Delete
if ( in_array( $post_format, array( 'audio', 'gallery', 'image', 'quote', 'video' ), true ) ) {
[303] Fix | Delete
$editor_settings['template'] = array( array( "core/$post_format" ) );
[304] Fix | Delete
}
[305] Fix | Delete
}
[306] Fix | Delete
[307] Fix | Delete
if ( wp_is_block_theme() && $editor_settings['supportsTemplateMode'] ) {
[308] Fix | Delete
$editor_settings['defaultTemplatePartAreas'] = get_allowed_block_template_part_areas();
[309] Fix | Delete
}
[310] Fix | Delete
[311] Fix | Delete
/**
[312] Fix | Delete
* Scripts
[313] Fix | Delete
*/
[314] Fix | Delete
wp_enqueue_media(
[315] Fix | Delete
array(
[316] Fix | Delete
'post' => $post->ID,
[317] Fix | Delete
)
[318] Fix | Delete
);
[319] Fix | Delete
wp_tinymce_inline_scripts();
[320] Fix | Delete
wp_enqueue_editor();
[321] Fix | Delete
[322] Fix | Delete
/**
[323] Fix | Delete
* Styles
[324] Fix | Delete
*/
[325] Fix | Delete
wp_enqueue_style( 'wp-edit-post' );
[326] Fix | Delete
[327] Fix | Delete
/**
[328] Fix | Delete
* Fires after block assets have been enqueued for the editing interface.
[329] Fix | Delete
*
[330] Fix | Delete
* Call `add_action` on any hook before 'admin_enqueue_scripts'.
[331] Fix | Delete
*
[332] Fix | Delete
* In the function call you supply, simply use `wp_enqueue_script` and
[333] Fix | Delete
* `wp_enqueue_style` to add your functionality to the block editor.
[334] Fix | Delete
*
[335] Fix | Delete
* @since 5.0.0
[336] Fix | Delete
*/
[337] Fix | Delete
do_action( 'enqueue_block_editor_assets' );
[338] Fix | Delete
[339] Fix | Delete
// In order to duplicate classic meta box behavior, we need to run the classic meta box actions.
[340] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/meta-boxes.php';
[341] Fix | Delete
register_and_do_post_meta_boxes( $post );
[342] Fix | Delete
[343] Fix | Delete
// Check if the Custom Fields meta box has been removed at some point.
[344] Fix | Delete
$core_meta_boxes = $wp_meta_boxes[ $current_screen->id ]['normal']['core'];
[345] Fix | Delete
if ( ! isset( $core_meta_boxes['postcustom'] ) || ! $core_meta_boxes['postcustom'] ) {
[346] Fix | Delete
unset( $editor_settings['enableCustomFields'] );
[347] Fix | Delete
}
[348] Fix | Delete
[349] Fix | Delete
$editor_settings = get_block_editor_settings( $editor_settings, $block_editor_context );
[350] Fix | Delete
[351] Fix | Delete
$init_script = <<<JS
[352] Fix | Delete
( function() {
[353] Fix | Delete
window._wpLoadBlockEditor = new Promise( function( resolve ) {
[354] Fix | Delete
wp.domReady( function() {
[355] Fix | Delete
resolve( wp.editPost.initializeEditor( 'editor', "%s", %d, %s, %s ) );
[356] Fix | Delete
} );
[357] Fix | Delete
} );
[358] Fix | Delete
} )();
[359] Fix | Delete
JS;
[360] Fix | Delete
[361] Fix | Delete
$script = sprintf(
[362] Fix | Delete
$init_script,
[363] Fix | Delete
$post->post_type,
[364] Fix | Delete
$post->ID,
[365] Fix | Delete
wp_json_encode( $editor_settings, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ),
[366] Fix | Delete
wp_json_encode( $initial_edits, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES )
[367] Fix | Delete
);
[368] Fix | Delete
wp_add_inline_script( 'wp-edit-post', $script );
[369] Fix | Delete
[370] Fix | Delete
if ( (int) get_option( 'page_for_posts' ) === $post->ID ) {
[371] Fix | Delete
add_action( 'admin_enqueue_scripts', '_wp_block_editor_posts_page_notice' );
[372] Fix | Delete
}
[373] Fix | Delete
[374] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-header.php';
[375] Fix | Delete
?>
[376] Fix | Delete
[377] Fix | Delete
<div class="block-editor">
[378] Fix | Delete
<h1 class="screen-reader-text hide-if-no-js"><?php echo esc_html( $title ); ?></h1>
[379] Fix | Delete
<div id="editor" class="block-editor__container hide-if-no-js"></div>
[380] Fix | Delete
<div id="metaboxes" class="hidden">
[381] Fix | Delete
<?php the_block_editor_meta_boxes(); ?>
[382] Fix | Delete
</div>
[383] Fix | Delete
[384] Fix | Delete
<?php // JavaScript is disabled. ?>
[385] Fix | Delete
<div class="wrap hide-if-js block-editor-no-js">
[386] Fix | Delete
<h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1>
[387] Fix | Delete
<?php
[388] Fix | Delete
if ( file_exists( WP_PLUGIN_DIR . '/classic-editor/classic-editor.php' ) ) {
[389] Fix | Delete
// If Classic Editor is already installed, provide a link to activate the plugin.
[390] Fix | Delete
$installed = true;
[391] Fix | Delete
$plugin_activate_url = wp_nonce_url( 'plugins.php?action=activate&amp;plugin=classic-editor/classic-editor.php', 'activate-plugin_classic-editor/classic-editor.php' );
[392] Fix | Delete
$message = sprintf(
[393] Fix | Delete
/* translators: %s: Link to activate the Classic Editor plugin. */
[394] Fix | Delete
__( 'The block editor requires JavaScript. Please enable JavaScript in your browser settings, or activate the <a href="%s">Classic Editor plugin</a>.' ),
[395] Fix | Delete
esc_url( $plugin_activate_url )
[396] Fix | Delete
);
[397] Fix | Delete
} else {
[398] Fix | Delete
// If Classic Editor is not installed, provide a link to install it.
[399] Fix | Delete
$installed = false;
[400] Fix | Delete
$plugin_install_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=classic-editor' ), 'install-plugin_classic-editor' );
[401] Fix | Delete
$message = sprintf(
[402] Fix | Delete
/* translators: %s: Link to install the Classic Editor plugin. */
[403] Fix | Delete
__( 'The block editor requires JavaScript. Please enable JavaScript in your browser settings, or install the <a href="%s">Classic Editor plugin</a>.' ),
[404] Fix | Delete
esc_url( $plugin_install_url )
[405] Fix | Delete
);
[406] Fix | Delete
}
[407] Fix | Delete
[408] Fix | Delete
/**
[409] Fix | Delete
* Filters the message displayed in the block editor interface when JavaScript is
[410] Fix | Delete
* not enabled in the browser.
[411] Fix | Delete
*
[412] Fix | Delete
* @since 5.0.3
[413] Fix | Delete
* @since 6.4.0 Added `$installed` parameter.
[414] Fix | Delete
*
[415] Fix | Delete
* @param string $message The message being displayed.
[416] Fix | Delete
* @param WP_Post $post The post being edited.
[417] Fix | Delete
* @param bool $installed Whether the classic editor is installed.
[418] Fix | Delete
*/
[419] Fix | Delete
$message = apply_filters( 'block_editor_no_javascript_message', $message, $post, $installed );
[420] Fix | Delete
wp_admin_notice(
[421] Fix | Delete
$message,
[422] Fix | Delete
array(
[423] Fix | Delete
'type' => 'error',
[424] Fix | Delete
)
[425] Fix | Delete
);
[426] Fix | Delete
?>
[427] Fix | Delete
</div>
[428] Fix | Delete
</div>
[429] Fix | Delete
[430] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function