Created
October 9, 2014 21:06
-
-
Save schurpf/e2188f8e0c31c9f2010c to your computer and use it in GitHub Desktop.
php: echo ACF without wrapping p tags
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
/** | |
* ACF without paragraphs | |
* @author schurpf | |
* @url http://schurpf.com | |
* @version 0.0 | |
* @date 2014-10-09 | |
* @dependency [none] | |
* @param string $field_name your normal ACF field name | |
* @return none echos field without wrapping p tags | |
* @source http://support.advancedcustomfields.com/forums/topic/removing-paragraph-tags-from-wysiwyg-fields/ | |
*/ | |
function the_field_without_wpautop( $field_name ) { | |
remove_filter('acf_the_content', 'wpautop'); | |
the_field( $field_name ); | |
add_filter('acf_the_content', 'wpautop'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment