Skip to content

Instantly share code, notes, and snippets.

@hereswhatidid
hereswhatidid / custom-acf-wysiwyg-css.php
Last active September 27, 2022 15:27
Applies defined CSS classes to the ACF WYSIWYG editor so that you can individually style them.
<?php
function hwid_acf_admin_footer() {
?>
<script>
( function( $) {
acf.add_filter( 'wysiwyg_tinymce_settings', function( mceInit, id ) {
// grab the classes defined within the field admin and put them in an array
var classes = $( '#' + id ).closest( '.acf-field-wysiwyg' ).attr( 'class' );