Edit File by line
/home/zeestwma/ajeebong.../wp-admin...
File: site-editor.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Site Editor administration screen.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
* @subpackage Administration
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
global $editor_styles;
[8] Fix | Delete
[9] Fix | Delete
/** WordPress Administration Bootstrap */
[10] Fix | Delete
require_once __DIR__ . '/admin.php';
[11] Fix | Delete
[12] Fix | Delete
if ( ! current_user_can( 'edit_theme_options' ) ) {
[13] Fix | Delete
wp_die(
[14] Fix | Delete
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
[15] Fix | Delete
'<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>',
[16] Fix | Delete
403
[17] Fix | Delete
);
[18] Fix | Delete
}
[19] Fix | Delete
[20] Fix | Delete
$is_template_part = isset( $_GET['postType'] ) && 'wp_template_part' === sanitize_key( $_GET['postType'] );
[21] Fix | Delete
$is_template_part_path = isset( $_GET['path'] ) && 'wp_template_partall' === sanitize_key( $_GET['path'] );
[22] Fix | Delete
$is_template_part_editor = $is_template_part || $is_template_part_path;
[23] Fix | Delete
$is_patterns = isset( $_GET['postType'] ) && 'wp_block' === sanitize_key( $_GET['postType'] );
[24] Fix | Delete
$is_patterns_path = isset( $_GET['path'] ) && 'patterns' === sanitize_key( $_GET['path'] );
[25] Fix | Delete
$is_patterns_editor = $is_patterns || $is_patterns_path;
[26] Fix | Delete
[27] Fix | Delete
if ( ! wp_is_block_theme() ) {
[28] Fix | Delete
if ( ! current_theme_supports( 'block-template-parts' ) && $is_template_part_editor ) {
[29] Fix | Delete
wp_die( __( 'The theme you are currently using is not compatible with the Site Editor.' ) );
[30] Fix | Delete
} elseif ( ! $is_patterns_editor && ! $is_template_part_editor ) {
[31] Fix | Delete
wp_die( __( 'The theme you are currently using is not compatible with the Site Editor.' ) );
[32] Fix | Delete
}
[33] Fix | Delete
}
[34] Fix | Delete
[35] Fix | Delete
// Used in the HTML title tag.
[36] Fix | Delete
$title = _x( 'Editor', 'site editor title tag' );
[37] Fix | Delete
$parent_file = 'themes.php';
[38] Fix | Delete
[39] Fix | Delete
// Flag that we're loading the block editor.
[40] Fix | Delete
$current_screen = get_current_screen();
[41] Fix | Delete
$current_screen->is_block_editor( true );
[42] Fix | Delete
[43] Fix | Delete
// Default to is-fullscreen-mode to avoid jumps in the UI.
[44] Fix | Delete
add_filter(
[45] Fix | Delete
'admin_body_class',
[46] Fix | Delete
static function ( $classes ) {
[47] Fix | Delete
return "$classes is-fullscreen-mode";
[48] Fix | Delete
}
[49] Fix | Delete
);
[50] Fix | Delete
[51] Fix | Delete
$indexed_template_types = array();
[52] Fix | Delete
foreach ( get_default_block_template_types() as $slug => $template_type ) {
[53] Fix | Delete
$template_type['slug'] = (string) $slug;
[54] Fix | Delete
$indexed_template_types[] = $template_type;
[55] Fix | Delete
}
[56] Fix | Delete
[57] Fix | Delete
$block_editor_context = new WP_Block_Editor_Context( array( 'name' => 'core/edit-site' ) );
[58] Fix | Delete
$custom_settings = array(
[59] Fix | Delete
'siteUrl' => site_url(),
[60] Fix | Delete
'postsPerPage' => get_option( 'posts_per_page' ),
[61] Fix | Delete
'styles' => get_block_editor_theme_styles(),
[62] Fix | Delete
'defaultTemplateTypes' => $indexed_template_types,
[63] Fix | Delete
'defaultTemplatePartAreas' => get_allowed_block_template_part_areas(),
[64] Fix | Delete
'supportsLayout' => wp_theme_has_theme_json(),
[65] Fix | Delete
'supportsTemplatePartsMode' => ! wp_is_block_theme() && current_theme_supports( 'block-template-parts' ),
[66] Fix | Delete
);
[67] Fix | Delete
[68] Fix | Delete
// Add additional back-compat patterns registered by `current_screen` et al.
[69] Fix | Delete
$custom_settings['__experimentalAdditionalBlockPatterns'] = WP_Block_Patterns_Registry::get_instance()->get_all_registered( true );
[70] Fix | Delete
$custom_settings['__experimentalAdditionalBlockPatternCategories'] = WP_Block_Pattern_Categories_Registry::get_instance()->get_all_registered( true );
[71] Fix | Delete
[72] Fix | Delete
$editor_settings = get_block_editor_settings( $custom_settings, $block_editor_context );
[73] Fix | Delete
[74] Fix | Delete
if ( isset( $_GET['postType'] ) && ! isset( $_GET['postId'] ) ) {
[75] Fix | Delete
$post_type = get_post_type_object( $_GET['postType'] );
[76] Fix | Delete
if ( ! $post_type ) {
[77] Fix | Delete
wp_die( __( 'Invalid post type.' ) );
[78] Fix | Delete
}
[79] Fix | Delete
}
[80] Fix | Delete
[81] Fix | Delete
$active_global_styles_id = WP_Theme_JSON_Resolver::get_user_global_styles_post_id();
[82] Fix | Delete
$active_theme = get_stylesheet();
[83] Fix | Delete
[84] Fix | Delete
$navigation_rest_route = rest_get_route_for_post_type_items(
[85] Fix | Delete
'wp_navigation'
[86] Fix | Delete
);
[87] Fix | Delete
[88] Fix | Delete
$preload_paths = array(
[89] Fix | Delete
array( '/wp/v2/media', 'OPTIONS' ),
[90] Fix | Delete
'/wp/v2/types?context=view',
[91] Fix | Delete
'/wp/v2/types/wp_template?context=edit',
[92] Fix | Delete
'/wp/v2/types/wp_template-part?context=edit',
[93] Fix | Delete
'/wp/v2/templates?context=edit&per_page=-1',
[94] Fix | Delete
'/wp/v2/template-parts?context=edit&per_page=-1',
[95] Fix | Delete
'/wp/v2/themes?context=edit&status=active',
[96] Fix | Delete
'/wp/v2/global-styles/' . $active_global_styles_id . '?context=edit',
[97] Fix | Delete
'/wp/v2/global-styles/' . $active_global_styles_id,
[98] Fix | Delete
'/wp/v2/global-styles/themes/' . $active_theme,
[99] Fix | Delete
array( $navigation_rest_route, 'OPTIONS' ),
[100] Fix | Delete
array(
[101] Fix | Delete
add_query_arg(
[102] Fix | Delete
array(
[103] Fix | Delete
'context' => 'edit',
[104] Fix | Delete
'per_page' => 100,
[105] Fix | Delete
'order' => 'desc',
[106] Fix | Delete
'orderby' => 'date',
[107] Fix | Delete
// array indices are required to avoid query being encoded and not matching in cache.
[108] Fix | Delete
'status[0]' => 'publish',
[109] Fix | Delete
'status[1]' => 'draft',
[110] Fix | Delete
),
[111] Fix | Delete
$navigation_rest_route
[112] Fix | Delete
),
[113] Fix | Delete
'GET',
[114] Fix | Delete
),
[115] Fix | Delete
);
[116] Fix | Delete
[117] Fix | Delete
block_editor_rest_api_preload( $preload_paths, $block_editor_context );
[118] Fix | Delete
[119] Fix | Delete
wp_add_inline_script(
[120] Fix | Delete
'wp-edit-site',
[121] Fix | Delete
sprintf(
[122] Fix | Delete
'wp.domReady( function() {
[123] Fix | Delete
wp.editSite.initializeEditor( "site-editor", %s );
[124] Fix | Delete
} );',
[125] Fix | Delete
wp_json_encode( $editor_settings )
[126] Fix | Delete
)
[127] Fix | Delete
);
[128] Fix | Delete
[129] Fix | Delete
// Preload server-registered block schemas.
[130] Fix | Delete
wp_add_inline_script(
[131] Fix | Delete
'wp-blocks',
[132] Fix | Delete
'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings() ) . ');'
[133] Fix | Delete
);
[134] Fix | Delete
[135] Fix | Delete
wp_add_inline_script(
[136] Fix | Delete
'wp-blocks',
[137] Fix | Delete
sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( isset( $editor_settings['blockCategories'] ) ? $editor_settings['blockCategories'] : array() ) ),
[138] Fix | Delete
'after'
[139] Fix | Delete
);
[140] Fix | Delete
[141] Fix | Delete
wp_enqueue_script( 'wp-edit-site' );
[142] Fix | Delete
wp_enqueue_script( 'wp-format-library' );
[143] Fix | Delete
wp_enqueue_style( 'wp-edit-site' );
[144] Fix | Delete
wp_enqueue_style( 'wp-format-library' );
[145] Fix | Delete
wp_enqueue_media();
[146] Fix | Delete
[147] Fix | Delete
if (
[148] Fix | Delete
current_theme_supports( 'wp-block-styles' ) &&
[149] Fix | Delete
( ! is_array( $editor_styles ) || count( $editor_styles ) === 0 )
[150] Fix | Delete
) {
[151] Fix | Delete
wp_enqueue_style( 'wp-block-library-theme' );
[152] Fix | Delete
}
[153] Fix | Delete
[154] Fix | Delete
/** This action is documented in wp-admin/edit-form-blocks.php */
[155] Fix | Delete
do_action( 'enqueue_block_editor_assets' );
[156] Fix | Delete
[157] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-header.php';
[158] Fix | Delete
?>
[159] Fix | Delete
[160] Fix | Delete
<div class="edit-site" id="site-editor">
[161] Fix | Delete
<?php // JavaScript is disabled. ?>
[162] Fix | Delete
<div class="wrap hide-if-js site-editor-no-js">
[163] Fix | Delete
<h1 class="wp-heading-inline"><?php _e( 'Edit site' ); ?></h1>
[164] Fix | Delete
<?php
[165] Fix | Delete
/**
[166] Fix | Delete
* Filters the message displayed in the site editor interface when JavaScript is
[167] Fix | Delete
* not enabled in the browser.
[168] Fix | Delete
*
[169] Fix | Delete
* @since 6.3.0
[170] Fix | Delete
*
[171] Fix | Delete
* @param string $message The message being displayed.
[172] Fix | Delete
* @param WP_Post $post The post being edited.
[173] Fix | Delete
*/
[174] Fix | Delete
$message = apply_filters( 'site_editor_no_javascript_message', __( 'The site editor requires JavaScript. Please enable JavaScript in your browser settings.' ), $post );
[175] Fix | Delete
wp_admin_notice(
[176] Fix | Delete
$message,
[177] Fix | Delete
array(
[178] Fix | Delete
'type' => 'error',
[179] Fix | Delete
'additional_classes' => array( 'hide-if-js' ),
[180] Fix | Delete
)
[181] Fix | Delete
);
[182] Fix | Delete
?>
[183] Fix | Delete
</div>
[184] Fix | Delete
</div>
[185] Fix | Delete
[186] Fix | Delete
<?php
[187] Fix | Delete
[188] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-footer.php';
[189] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function