WordPress 3.5 image insert fails with "send_to_editor is not a function" – FIXED
I was seeing an issue in my custom theme upload code where I could not insert images.
Steps to reproduce:
- Click insert image button on toolbar
- Select, upload image
- Enter details in custom dialog, click “insert” button, which calls
Image inserted in article editor
This error occurs because prior to 3.5 the
media-uploadscript (which contains
send_to_editoralways gets loaded; in 3.5, it is only loaded in some cases. The fix is to invoke
wp_enqueue_scriptin my theme’s functions.php in order to load the media-upload script every time:
wp_enqueue_script( 'media-upload' );
I’m posting this in case someone else sees the same issue, so they can find this solution via search.
Here’s the fix on Github:
- The topic ‘WordPress 3.5 image insert fails with "send_to_editor is not a function" – FIXED’ is closed to new replies.