How/Where is editor.min.js Added to the wp-admin Post Page?

How/Where is the wp-admin/js/editor.min.js file added to the backend WordPress post editing page (wp-admin/post.php)? How could I change this to use the non-minified file?

I’m working on a browser extension that will interact with a WordPress installation. I’d like to add some temporary debugging code the the editor.js file. However, in a standard WordPress 3.5.1 site, this file is already minimized, and somehow loaded on the page via a mechanism that isn’t a standard <script/> tag. I’d like to know how the WordPress core team includes (and/or a minimize workflow for) this file.

Read More

Put another way, if I wanted to add a feature that required changing editor.js, how would I go about developing that.

Competent programmer here, not super familiar with WordPress’s architecture. In case my words failed me above, I’m not looking to extend WordPress, I’m trying to diagnose existing system behavior.

Thanks in advance!

Related posts

3 comments

  1. WordPress concatenates scripts via the script-loader.php file.

    You can disable the concatenation of scripts by adding this to your wp-config.php:

    define('CONCATENATE_SCRIPTS', false);
    

    You can load the non-minified versions by adding this to wp-config.php:

    define('SCRIPT_DEBUG', true);
    
  2. Put define(‘SCRIPT_DEBUG’, true); into your wp-config.php. It will force to use editor.js which is not minified (development) version of editor.min.js. You can test your changes and when satisfied minify it then replace original editor.min.js with it. Remember to keep your version backed up so you will not lose it during core upgrade.

  3. To use the unminified code, you can just unregister the minified JS and register the non-minified code.

    However, there’s really no reason to do this if you just want to explore the code.. just view the file in your IDE. All of the files are in ‘/wp-admin/js’.

Comments are closed.