Support

Account

Home Forums Backend Issues (wp-admin) Avoiding admin editors tags strip Reply To: Avoiding admin editors tags strip

  • For stopping removing <p> tags inside WordPress TinyMCE (classic) editor (during switch Visual and Text editor’s tabs),

    I add to ${THEME_FOLDER}/functions.php:

    remove_filter( ‘the_content’, ‘wpautop’ );
    remove_filter( ‘the_excerpt’, ‘wpautop’ );
    remove_filter( ‘term_decription’, ‘wpautop’ );

    function config_tinymce( $config ) {
    $config[‘wpautop’] = false;
    return $config;
    }
    add_filter( ‘tiny_mce_before_init’, ‘config_tinymce’, 10 );

    But this doesn’t work for ACF’s fields editors.

    Help, please? Thanks!

    ———————

    Spoiler:

    function acf_wysiwyg_remove_wpautop() {
    remove_filter( ‘acf_the_content’, ‘wpautop’ );
    }
    add_action( ‘acf/init’, ‘acf_wysiwyg_remove_wpautop’);

    with

    remove_filter( ‘acf_the_content’, ‘wpautop’ );

    don’t work.

    I think, we need something like (analogue of)

    function config_tinymce( $config ) {
    $config[‘wpautop’] = false;
    return $config;
    }
    add_filter( ‘tiny_mce_before_init’, ‘config_tinymce’, 10 );