Support

Account

Home Forums Add-ons Repeater Field Need to remove tag from one of two wysiwyg fields Reply To: Need to remove tag from one of two wysiwyg fields

  • ACF automatically runs a number of filters on the content and does not have any way to avoid this for only a single WYSIWYG field. The only way to do this would be to get the value unformatted

    
    get_field('wysiwyg_field_name', false, false);
    // or 
    get_sub_field('wysiwyg_field_name', false);
    

    and then apply each of the filters yourself in the correct order with the exception of ‘wpautop’

    From ACF code

    
    
    		function add_filters() {
    
    			// WordPress 5.5 introduced new function for applying image tags.
    			$wp_filter_content_tags = function_exists( 'wp_filter_content_tags' ) ? 'wp_filter_content_tags' : 'wp_make_content_images_responsive';
    
    			// Mimic filters added to "the_content" in "wp-includes/default-filters.php".
    			add_filter( 'acf_the_content', 'capital_P_dangit', 11 );
    			// add_filter( 'acf_the_content', 'do_blocks', 9 ); Not yet supported.
    			add_filter( 'acf_the_content', 'wptexturize' );
    			add_filter( 'acf_the_content', 'convert_smilies', 20 );
    			add_filter( 'acf_the_content', 'wpautop' );
    			add_filter( 'acf_the_content', 'shortcode_unautop' );
    			// add_filter( 'acf_the_content', 'prepend_attachment' ); Causes double image on attachment page.
    			add_filter( 'acf_the_content', $wp_filter_content_tags );
    			add_filter( 'acf_the_content', 'do_shortcode', 11 );
    
    			// Mimic filters added to "the_content" in "wp-includes/class-wp-embed.php"
    			if ( isset( $GLOBALS['wp_embed'] ) ) {
    				add_filter( 'acf_the_content', array( $GLOBALS['wp_embed'], 'run_shortcode' ), 8 );
    				add_filter( 'acf_the_content', array( $GLOBALS['wp_embed'], 'autoembed' ), 8 );
    			}
    		}