Make WordPress Core

Opened 14 months ago

Closed 8 weeks ago

Last modified 7 weeks ago

#23591 closed defect (bug) (fixed)

Can't insert media into wp_editor() without quicktags and/or tinymce

Reported by: trepmal Owned by:
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.5.1
Component: Editor Keywords:
Focuses: Cc:


If I set up an editor with no TinyMCE or Quicktags, I'm unable to insert any media.

$args = array(
	'tinymce' => false,
	'quicktags' => false,
	'textarea_rows' => 5,
wp_editor( '', 'test1', $args );

No js errors or anything. Media modal comes up, I can use it without any issue, but as soon as I click insert (be it single media or gallery), nothing happens.

I have to enable tinymce and/or quicktags to get media insertion to work.

Here's a simple plugin for testing: https://gist.github.com/trepmal/5016952

I can replicate this in 3.5.1 and trunk, have not tested in anything older.

I don't think this is a browser quirk, but just in case, I've tested and confirmed the issue in Firefox 19 and Chrome 25.0.1364.84 beta both on Mac 10.8.2.

Change History (4)

comment:1 trepmal14 months ago

Someone on twitter showed me the trick to fix this

<script type="text/javascript">
jQuery(function($) {
	$(document.body).on( 'click', '.insert-media', function( event ) {
		wpActiveEditor = $(this).data('editor');

I'm sure somebody with better js chops can make a nice patch.

comment:2 richard_steeleagency14 months ago

Something about wp_editor() changed in a recent release and broke one of my plugins.

Clicking the media button just pops the user to the top of the page on a plugin with a WYSIWYG editor field on a custom model that is not a custom post type.

I've added this JavaScript which seems to fix the issue and am sending it out to some of my test users.

comment:3 kovshenin8 weeks ago

  • Component changed from Media to Editor
  • Resolution set to fixed
  • Status changed from new to closed

I think this is fixed by r26881. Couldn't reproduce in trunk, but feel free to reopen!

comment:4 SergeyBiryukov7 weeks ago

  • Keywords needs-patch removed
  • Milestone changed from Awaiting Review to 3.9
Note: See TracTickets for help on using tickets.