Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#33257 closed defect (bug) (fixed)

Wp Editor front end missing add media button

Reported by: alexandruias's profile alexandruias Owned by: azaozz's profile azaozz
Milestone: 4.3 Priority: normal
Severity: major Version: 4.3
Component: Editor Keywords: has-patch commit
Focuses: Cc:

Description

This is the code that I use to setup the wp editor in front-end.You can paste in a theme file.

<?php $content = 'none';

$settings = array(
	'media_buttons' => true,
	'drag_drop_upload' => true,
);

$editor_id ='customusername';

echo '<div style="float:right;max-width:600px">';
wp_editor($content,$editor_id,$settings);
echo '</div>';?>

In 4.2.3 the editor shows the add media button but the latest trunk doesn't.
In the trunk I can see with inspect element that is trying to generate the add media button but is only an empty div.

<div id="wp-customusername-media-buttons" class="wp-media-buttons"></div>

Everything is default no theme or plugin installed or activated.

Attachments (2)

bug.png (192.9 KB) - added by alexandruias 9 years ago.
33257.diff (1.6 KB) - added by wonderboymusic 9 years ago.

Download all attachments as: .zip

Change History (13)

@alexandruias
9 years ago

#1 @alexandruias
9 years ago

  • Severity changed from normal to major

This ticket was mentioned in Slack in #core by alexandruias. View the logs.


9 years ago

#3 @obenland
9 years ago

  • Milestone changed from Awaiting Review to 4.3
  • Owner set to azaozz
  • Status changed from new to assigned

Confirmed, @azaozz, @iseulde, could you take a look?

#4 @ocean90
9 years ago

  • Keywords needs-patch added

Broken since [32653]. add_action( 'media_buttons', 'media_buttons' ); was moved to wp-admin/includes/admin-filters.php.

This ticket was mentioned in Slack in #core-editor by ocean90. View the logs.


9 years ago

#6 @azaozz
9 years ago

Seems the straightforward way to fix this would be to add add_action( 'media_buttons', 'media_buttons' ); to class-wp-editor.php.

However likely there will be more cases of missing add_action and add_filter. Looking through the files from where the actions were moved, several more are sometimes included in non wp-admin context.

Reopening #32529 for further investigation.

This ticket was mentioned in Slack in #core by ocean90. View the logs.


9 years ago

@wonderboymusic
9 years ago

#8 @wonderboymusic
9 years ago

  • Keywords has-patch added; needs-patch removed

33257.diff moves 3 filters to default-filters.php from admin-filters.php - the hooks get fired in the same file that contains the callbacks.

#9 follow-up: @azaozz
9 years ago

  • Keywords commit added

33257.diff looks good.

#10 in reply to: ↑ 9 @obenland
9 years ago

Replying to azaozz:

33257.diff looks good.

With wonderboymusic's and your sign-off, this is ready to go in.

#11 @markjaquith
9 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 33590:

Move media hooks out of admin-filters.php as sometimes editors are used on the front end.

fixes #33257
props wonderboymusic

Note: See TracTickets for help on using tickets.