0

I need to add a static block of text above the editor. This needs to appear not only on post edit screens, but also the widgets screen, as I'm using a plugin to enable usage of the visual editor there as well.

On post edit screens, the filters edit_form_after_editor and edit_form_after_title work ok, the placement isn't ideal, but neither of them work on the widget screen, so they're not usable.

The only filter I've found that actually applies to the editor itself is tiny_mce_before_init but I'm not sure how I could use that to just add static text.

I suppose Javascript is an option too, but I'd rather use PHP if possible.

  • To do this on the widget screen, you'll probably want to hook into the specific plugin you're using - that's if you want the text to show directly above the editor. Does the plugin you're using have any hooks or actions you can use for this? – Tim Malone Jun 2 '16 at 7:40
  • I couldn't find any in the documentation. It appears to just extend the default TinyMCE, so I assumed any filter that applied to that would also work for the plugin, but I wasn't able to find any that worked. – Josh Warren Jun 2 '16 at 8:54
  • 1
    Not all filters/actions are documented - particularly with plugins. Often you've gotta look through the plugin files. Just search for apply_filters and do_action :) – Tim Malone Jun 2 '16 at 9:04
  • Good point, I never thought of just searching for that before. It turns out there are hooks for before and after the editor that would work for the widget. The placement still isn't ideal, so I'll probably just stick with ACF for now, but I could definitely make that work too. – Josh Warren Jun 2 '16 at 9:29
0

I ended up just using ACF for this. I created a message field, and then displayed it on post screens below the editor, and on the visual editor widget for the plugin I was using. Not ideal in terms of formatting or placement, but good enough.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.