Skip to content

Instantly share code, notes, and snippets.

@hereswhatidid
Created August 12, 2015 20:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hereswhatidid/891c2ac452f35fea89fb to your computer and use it in GitHub Desktop.
Save hereswhatidid/891c2ac452f35fea89fb to your computer and use it in GitHub Desktop.
Adds a custom class to a specific WYSIWYG editor within Advanced Custom Fields.
<?php
function my_acf_admin_footer() {
?>
<script>
( function( $) {
acf.add_filter( 'wysiwyg_tinymce_settings', function( mceInit, id ) {
if ( id === 'special-wysiwyg-field' ) {
mceInit.body_class += ' magical-field-class';
}
return mceInit;
});
})( jQuery );
</script>
<?php
}
add_action('acf/input/admin_footer', 'my_acf_admin_footer');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment