WordPress.org

Make WordPress Core

#45150 closed defect (bug) (maybelater)

Account for improper use of the TinyMCE init array filters

Reported by: azaozz Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: TinyMCE Keywords:
Focuses: Cc:
PR Number:

Description (last modified by azaozz)

In plugins when any of the TinyMCE init array filters ('mce_external_plugins', 'tiny_mce_plugins', 'mce_buttons', 'mce_buttons_2', etc.) are used to output content, that content may appear at random location, or even be outputted before HTML headers are sent and cause PHP warnings.

Change History (3)

#1 @azaozz
13 months ago

This seems a classic case of "doing it wrong" :) There is already a much more suitable filter, 'the_editor', for outputting HTML that has to appear together with the editor HTML. There are also a bunch of actions in edit-form-advanced.php that can be used.

IMHO the proper thing to do here it to capture the output when the init array filters run, and if anything was outputted throw a "Doing it wrong" warning. That will fix unwanted HTML appearing at random places.

In some cases it may be possible to try to "redirect" such output to the proper filter, but that may bring other bugs/edge cases.

Last edited 13 months ago by azaozz (previous) (diff)

#2 @azaozz
13 months ago

  • Description modified (diff)

#3 @azaozz
13 months ago

  • Milestone 5.0 deleted
  • Resolution set to maybelater
  • Status changed from new to closed

Mistook a reported bug about this type of usage. As there aren't any reported cases, moving this to "maybelater".

Note: See TracTickets for help on using tickets.