Changeset 43879 for branches/5.0/src/wp-includes/blocks.php
- Timestamp:
- 11/09/2018 08:28:40 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.0/src/wp-includes/blocks.php
r43770 r43879 199 199 */ 200 200 function do_blocks( $content ) { 201 // If there are blocks in this content, we shouldn't run wpautop() on it later. 202 $priority = has_filter( 'the_content', 'wpautop' ); 203 if ( false !== $priority && doing_filter( 'the_content' ) && has_blocks( $content ) ) { 204 remove_filter( 'the_content', 'wpautop', $priority ); 205 add_filter( 'the_content', '_restore_wpautop_hook', $priority + 1 ); 206 } 207 201 208 $blocks = parse_blocks( $content ); 202 209 return _recurse_do_blocks( $blocks, $blocks ); 210 } 211 212 /** 213 * If do_blocks() needs to remove wp_autop() from the `the_content` filter, this re-adds it afterwards, 214 * for subsequent `the_content` usage. 215 * 216 * @access private 217 * 218 * @since 5.0.0 219 * 220 * @param string $content The post content running through this filter. 221 * @return string The unmodified content. 222 */ 223 function _restore_wpautop_hook( $content ) { 224 global $wp_filter; 225 $current_priority = $wp_filter['the_content']->current_priority(); 226 227 add_filter( 'the_content', 'wpautop', $current_priority - 1 ); 228 remove_filter( 'the_content', '_restore_wpautop_hook', $current_priority ); 229 230 return $content; 203 231 } 204 232
Note: See TracChangeset
for help on using the changeset viewer.