WordPress.org

Make WordPress Core

Opened 11 months ago

Last modified 6 weeks ago

#24472 new enhancement

Filter for wp_editor() arguments on attachment edit screen

Reported by: navitronic Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.5.1
Component: Media Keywords: has-patch
Focuses: administration Cc:

Description

Hi,

I have run into an issue where I need the WordPress wysiwyg editor (rather than the stripped down version currently there) on the edit media page.

I have looked at the code that generates the page and there seems to be no filter or action available to override the tinymce value when the call the wp_editor is made.

Would it be possible to add a filter here, so that the false value is overridable if needed?

Thanks,

Adrian.

Attachments (2)

24472.diff (1.0 KB) - added by DH-Shredder 8 weeks ago.
Filter for wp_editor() description arguments
24472.2.diff (1.1 KB) - added by DH-Shredder 7 weeks ago.
Do not allow filtering of textarea_name

Download all attachments as: .zip

Change History (10)

comment:1 SergeyBiryukov10 months ago

  • Component changed from Administration to Media

DH-Shredder8 weeks ago

Filter for wp_editor() description arguments

comment:2 DH-Shredder8 weeks ago

  • Focuses administration added
  • Keywords has-patch added
  • Milestone changed from Awaiting Review to Future Release

Hi Navitronic!

Thanks for your ticket. Apologies for the wait on a reply! I like the idea, as I see why you might want to set it up that way, and have attached a potential patch to add a attachment_description_editor_args to allow filtering of the wp_editor() settings for the attachment description field..

comment:3 DH-Shredder8 weeks ago

  • Summary changed from TinyMCE editor on attachment edit screen to Filter for wp_editor() arguments on attachment edit screen

comment:4 DrewAPicture7 weeks ago

  • Milestone changed from Future Release to 3.9

The hook docs in 24472.diff look good.

Might swap out that "See docs for wp_editor() for details." sentence for a standalone @see wp_editor() tag between the @since and @param lines.

comment:5 helen7 weeks ago

I don't mind this, necessarily, but some args shouldn't be filterable, like the textarea_name. This also makes it easier to expose attaching attachments to attachments, which isn't horrible, but just wanted to point that out.

DH-Shredder7 weeks ago

Do not allow filtering of textarea_name

comment:6 DH-Shredder7 weeks ago

helen: Agreed. Went ahead and forced textarea_name in 24472.2.diff.

Per your comment, we could force an array of args if you think that other fields like media_buttons also should not be allowed to be changed.

Alternately, we could whitelist filtered parameters, but I can see potential use cases for the rest.

comment:7 ircbot6 weeks ago

This ticket was mentioned in IRC in #wordpress-dev by DH-Shredder. View the logs.

comment:8 helen6 weeks ago

  • Milestone changed from 3.9 to Future Release

I'm still hemming and hawing over this, which tells me that this is a punt at the moment.

nacin: feels weird that this particular location gets a filter

DH-Shredder: Think there's a better way to handle it, perhaps globally? At the time, I only thought "why not," if there's not a better way to modify it.

DH-Shredder: Since we're pretty liberal with filters

helen: nacin: DH-Shredder: i guess it is kind of weird since other wp_editor() instances for content don't have it... but then we should probably allow for the editor instance to be unhooked/otherwise removed so people can register their own.

Note: See TracTickets for help on using tickets.