Home Forums Feature Requests Add $field to wysiwyg_tinymce_settings hook


Add $field to wysiwyg_tinymce_settings hook

  • current implementation is:

    mceInit = acf.apply_filters('wysiwyg_tinymce_settings', mceInit,;

    could it be changed to include $field like this:

    mceInit = acf.apply_filters('wysiwyg_tinymce_settings', mceInit,, $field);

    i can get $field by jumping through some jquery hoops .. but it would be easier if it was just passed into the filter

  • The best place to submit this request would be here

    In the mean time, what are you looking to do that you need $field for? Maybe there’s a way to do it.

  • i’m trying to add a class to the ‘body_class’ setting of the tinymce editor before it gets initialized … i need to be able to add custom styles to different WYSIWYG ACF fields and the moment there is no way to differentiate them if there is more than one on a page

    by including the $field i could then add a field specific class to each editor instance

  • I’m not familiar with this hook, what is the value of

  • ignore the comment that I deleted, I was looking at the wrong hook.

    You can get the field key of the field if that helps you.

    acf.add_filter('wysiwyg_tinymce_settings', function( mceInit, id ){
      // do something to mceInit
      // return
      return mceInit;
  • thanks . .yeah i’m doing something like that .. but it’s not very intuitive .. seems like it could make it easier for everyone if a reference to $field was just passed through

  • Like I said, you should open a new ticket on this. $field is passed in the wysiwyg_tinymce_init action and I’d think that Elliot would be probably add it to the wysiwyg_tinymce_settings filter, but the best way for him to get the request is to open a support ticket.

  • thanks .. will do

  • I actually write a lot of custom JS for ACF lately and .closest('.acf-field'). is becoming something that I can type without thinking even needing to think, it’s programmed into my fingers at this point.

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

The topic ‘Add $field to wysiwyg_tinymce_settings hook’ is closed to new replies.