0

I've always used the plugin TinyMCE Advance that lets me drag and drop which buttons I want to show in the Editor. Now I'm trying to set those using my functions.php instead. That way I never have to worry about it. Here's what I've done, but I'm not seeing the results:

function myformatTinyMCE($in){
 $in['plugins']='inlinepopups,tabfocus,paste,media,fullscreen,wordpress,wpeditimage,wpgallery,wplink,wpdialogs,wpfullscreen';
 $in['wpautop']=true;  
 $in['apply_source_formatting']=false;
 $in['theme_advanced_buttons1']='bold,italic,underline,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,unlink,anchor,|,wp_fullscreen,wp_adv';
 $in['theme_advanced_buttons2']='formatselect|pastetext,pasteword,removeformat,|,hr,charmap,|,undo,redo,|,html';
 $in['theme_advanced_buttons3']='';
 $in['theme_advanced_buttons4']='';

 return $in;
}
add_filter('tiny_mce_before_init', 'myformatTinyMCE');

Edit: It's working in WP Pages and Posts, but I'm using the Advanced Custom Fields plugin, and on WYSIWYGs created by that plugin it does not work. Is there a way to force it to work with that as well?

  • Maybe you have to hook with a higher priority? Just try add_filter('tiny_mce_before_init', 'myformatTinyMCE', 100); or higher, or have a look at the source of ACF. – tfrommen Jan 31 '14 at 19:50
  • I hadn't known about that priority setting so that's cool unfortunately that didn't work. I will have to check in with ACF forums when they open back up. – paper_robots Jan 31 '14 at 20:36
  • I just had a short glimpse at ACF. They seem to use the teenyMCE, so just try to hook your function to 'teeny_mce_before_init' as well. – tfrommen Jan 31 '14 at 20:50

Your Answer

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

Browse other questions tagged or ask your own question.