Last active
April 14, 2020 06:52
-
-
Save rafaehlers/55416ab7ec8b5ba145ff4f2dade3e6d5 to your computer and use it in GitHub Desktop.
Prevents the wpautop (BR and P tags) function from running on a custom content field.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Remove wpautop() when Gravity Forms is in the field content | |
*/ | |
add_filter( 'gravityview/field_output/args', function( $args, $passed_args, $context = null ) { | |
if( $context && $context instanceof \GV\Template_Context ) { | |
$content = \GV\Utils::get( $args, 'value', '' ); | |
if( has_shortcode( $content, 'gravityform') ) { | |
$args['wpautop'] = false; | |
} | |
} | |
return $args; | |
}, 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment