Support

Account

Home Forums Bug Reports WYSIWYG fields not taking custom TinyMCE settings if WP editor is not present

Solved

WYSIWYG fields not taking custom TinyMCE settings if WP editor is not present

  • I have a few of customizations for my WP editor:
    * custom color swatches (in a specific order)
    * 5 JS plugins to do things like create placeholders, insert icons or shortcodes, ect
    * a ton of custom formats
    * various other visual components via CSS

    these are all added via WP hooks like “tiny_mce_before_init”, “mce_buttons_4”, and “mce_external_plugins” and these word fine for the regular EP editors. These also work as expected for ACF WYSIWYG fields BUT ONLY when a WP editor field is also on the page.

    If I put a WYSIWYG field on an options page, or a taxonomy term edit page then none of my custom options are there. If you use Automattic’s “Advanced Editor Tools” plugin to say add a font family button or add font colors – those buttons WILL appear, but they will be missing any custom settings added via “tiny_mce_before_init”.

    Looking at the WP source code, it looks like WP takes the user settings and spits them out as a JS object and adds that the the JS to build the tinymce instance: https://github.com/WordPress/WordPress/blob/master/wp-includes/class-wp-editor.php#L1566

    It doesnt seem that this is run for the ACF instances of the editor. I put a var_dump & die statement in there which will print on an edit post page but will NOT print on say an option page with the ACF editor in it.

  • EDIT – there was an errant filter somewhere else in this code base that was causing this issue. My bad. Unfortunately it doesn’t look like we can delete or edit our own posts here so maybe an admin can kill this thread.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.