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