Home / APIs / do_blocks() – Parses dynamic blocks out of `post_content` and re-renders them.

You appear to be a bot. Output may be restricted

Description

Parses dynamic blocks out of post_content and re-renders them.

Usage

$string = do_blocks( $content );

Parameters

$content
( string ) required – Post content.

Returns

string Updated post content.

Source

File name: wordpress/wp-includes/blocks.php
Lines: 1 to 17 of 17

function do_blocks( $content ) {
  // If there are blocks in this content, we shouldn't run wpautop() on it later.
  $priority = has_filter( 'the_content', 'wpautop' );
  if ( false !== $priority && doing_filter( 'the_content' ) && has_blocks( $content ) ) {
    remove_filter( 'the_content', 'wpautop', $priority );
    add_filter( 'the_content', '_restore_wpautop_hook', $priority + 1 );
  }

  $blocks = parse_blocks( $content );
  $output = '';

  foreach ( $blocks as $block ) {
    $output .= render_block( $block );
  }

  return $output;
}
 

 View on GitHub View on Trac

Published: 7th December 2018 | Last updated: 7th December 2018

Information

Function name: do_blocks
Plugin ref: WordPress
Version: 5.0.3
Sourcefile: wp-includes/blocks.php
File ref: wp-includes/blocks.php
Deprecated?: No
API Letters: B,D

  • Plugins
  • Themes
  • Shortcodes
  • APIs
  • Files
  • Hooks
  • Classes
  • Sites
  • Sitemap
  • Blog
WooCommerce a2z WooCommerce a2z
WooCommerce

Site:  woocommerce.wp-a2z.org
© Copyright WooCommerce a2z 2014-2019. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins