Make WordPress Core

Opened 18 months ago

Last modified 4 months ago

#44641 new defect (bug)

Customizing Button Text in Custom Media Manager Frame Doesn't Work Anymore

Reported by: Kelderic Owned by:
Milestone: 5.4 Priority: normal
Severity: normal Version: 4.9.7
Component: Media Keywords: has-patch needs-testing 2nd-opinion early
Focuses: Cc:
PR Number:



I have a plugin that calls up the Media Manager. I use the "gallery" state, and customize the main button text via the wp.media arguments. I've noticed a regression. The text in the primary button is no longer overridden by the arguments that I pass.

What I'm Doing (Code is simplified)

var file_frame = wp.media.frame = wp.media({
	frame: 'post',
	state: 'gallery',
	library : { type : 'image'},
	button: {text: 'Edit Image Order'},  // <----- LINE IN QUESTION
	multiple: true


What Should Happen

The text inside the primary button in the media manager modal should change from "Create a new Gallery" to "Edit Image Order".


What Actually Happens

The button ignores my arguments and retains its default text.


Attachments (2)

44641.diff (1.5 KB) - added by donmhico 5 months ago.
44641.2.diff (718 bytes) - added by donmhico 5 months ago.
A better fix than the first patch.

Download all attachments as: .zip

Change History (9)

#1 @Kelderic
18 months ago

I've found a workaround, btw. Before triggering the frame.open() function, I can set my own value into wp.media.view.l10n.insertIntoPost. Then reset that value after I open the frame.


var originalInsertIntoPost = wp.media.view.l10n.insertIntoPost;

wp.media.view.l10n.insertIntoPost = 'Select Icon';




wp.media.view.l10n.insertIntoPost = originalInsertIntoPost;

This works and doesn't affect any other frames, but it seems hacky.

#2 @joemcgill
9 months ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 5.3

Hi @Kelderic,

Thanks for the report and for following up with your workaround. I agree that this is hacky and should be fixed. I was able to confirm that this is still an issue in WordPress 5.2-beta3, though I wasn't able to investigate why this is happening. I'm going to add this to the 5.3 milestone for further investigation.

#3 @Kelderic
6 months ago

I appreciate the response, @joemcgill, but I'm afraid that this has gotten lost in the hundreds of tickets assigned to 5.3.

5 months ago

#4 @donmhico
5 months ago

  • Keywords has-patch needs-testing added; needs-patch removed

I've attached a patch, 44641.diff, but i'm not sure if this is what we want. On one hand, it does change the button label in the initial frame displayed. However, when you try to go to different frames by clicking the menu nav links in the left panel. The button labels of the new loaded frames will then revert to using the default label.

Now my question is, do we want the button label we set in the initialization of wp.media() -

var file_frame = wp.media.frame = wp.media({
	frame: 'post',
	state: 'gallery',
	library : { type : 'image'},
	button: {text: 'Edit Image Order'},  // <----- LINE IN QUESTION
	multiple: true

used in all of the frames? Or we just want it to be in the initial opened frame?

5 months ago

A better fix than the first patch.

#5 @davidbaumwald
4 months ago

  • Keywords 2nd-opinion added

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

4 months ago

#7 @davidbaumwald
4 months ago

  • Keywords early added
  • Milestone changed from 5.3 to 5.4

This ticket was discussed during today's bug scrub. It's a little late in the 5.3 cycle for inclusion, so it's being moved to 5.4 with an early tag for more soak time.

Note: See TracTickets for help on using tickets.