'message', 'additional_classes' => array( 'error' ), ) ); ?>
1, // This means "success" for some reason. 'plugin' => $plugin, 'file' => $file, ), admin_url( 'plugin-editor.php' ) ) ); exit; } } // List of allowable extensions. $editable_extensions = wp_get_plugin_file_editable_extensions( $plugin ); if ( ! is_file( $real_file ) ) { wp_die( sprintf( '

%s

', __( 'File does not exist! Please double check the name and try again.' ) ) ); } else { // Get the extension of the file. if ( preg_match( '/\.([^.]+)$/', $real_file, $matches ) ) { $ext = strtolower( $matches[1] ); // If extension is not in the acceptable list, skip it. if ( ! in_array( $ext, $editable_extensions, true ) ) { wp_die( sprintf( '

%s

', __( 'Files of this type are not editable.' ) ) ); } } } get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __( 'Overview' ), 'content' => '

' . __( 'You can use the plugin file editor to make changes to any of your plugins’ individual PHP files. Be aware that if you make changes, plugins updates will overwrite your customizations.' ) . '

' . '

' . __( 'Choose a plugin to edit from the dropdown menu and click the Select button. Click once on any file name to load it in the editor, and make your changes. Do not forget to save your changes (Update File) when you are finished.' ) . '

' . '

' . __( 'The documentation menu below the editor lists the PHP functions recognized in the plugin file. Clicking Look Up takes you to a web page about that particular function.' ) . '

' . '

' . __( 'When using a keyboard to navigate:' ) . '

' . '' . '

' . __( 'If you want to make changes but do not want them to be overwritten when the plugin is updated, you may be ready to think about writing your own plugin. For information on how to edit plugins, write your own from scratch, or just better understand their anatomy, check out the links below.' ) . '

' . ( is_network_admin() ? '

' . __( 'Any edits to files from this screen will be reflected on all sites in the network.' ) . '

' : '' ), ) ); get_current_screen()->set_help_sidebar( '

' . __( 'For more information:' ) . '

' . '

' . __( 'Documentation on Editing Plugins' ) . '

' . '

' . __( 'Documentation on Writing Plugins' ) . '

' . '

' . __( 'Support forums' ) . '

' ); $settings = array( 'codeEditor' => wp_enqueue_code_editor( array( 'file' => $real_file ) ), ); wp_enqueue_script( 'wp-theme-plugin-editor' ); wp_add_inline_script( 'wp-theme-plugin-editor', sprintf( 'jQuery( function( $ ) { wp.themePluginEditor.init( $( "#template" ), %s ); } )', wp_json_encode( $settings ) ) ); wp_add_inline_script( 'wp-theme-plugin-editor', sprintf( 'wp.themePluginEditor.themeOrPlugin = "plugin";' ) ); require_once ABSPATH . 'wp-admin/admin-header.php'; update_recently_edited( WP_PLUGIN_DIR . '/' . $file ); if ( ! empty( $posted_content ) ) { $content = $posted_content; } else { $content = file_get_contents( $real_file ); } if ( str_ends_with( $real_file, '.php' ) ) { $functions = wp_doc_link_parse( $content ); if ( ! empty( $functions ) ) { $docs_select = ''; } } $content = esc_textarea( $content ); ?>

array( 'updated', 'is-dismissible' ), 'id' => 'message', ) ); elseif ( is_wp_error( $edit_error ) ) : $error = esc_html( $edit_error->get_error_message() ? $edit_error->get_error_message() : $edit_error->get_error_code() ); $message = '

' . __( 'There was an error while trying to update the file. You may need to fix something and try updating again.' ) . '

' . $error . '
'; wp_admin_notice( $message, array( 'type' => 'error', 'id' => 'message', 'paragraph_wrap' => false, ) ); endif; ?>

' . esc_html( $file ) . '' ); } else { /* translators: %s: Plugin file name. */ printf( __( 'Browsing %s (active)' ), '' . esc_html( $file ) . '' ); } } else { if ( is_writable( $real_file ) ) { /* translators: %s: Plugin file name. */ printf( __( 'Editing %s (inactive)' ), '' . esc_html( $file ) . '' ); } else { /* translators: %s: Plugin file name. */ printf( __( 'Browsing %s (inactive)' ), '' . esc_html( $file ) . '' ); } } ?>


Warning: Making changes to active plugins is not recommended.' ), array( 'type' => 'warning', 'additional_classes' => array( 'inline', 'active-plugin-edit-warning' ), ) ); } ?>

Changing File Permissions for more information.' ), __( 'https://wordpress.org/documentation/article/changing-file-permissions/' ) ); ?>