Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save generatepress/8379abe390179c9fe828f2d6aa068eef to your computer and use it in GitHub Desktop.
Save generatepress/8379abe390179c9fe828f2d6aa068eef to your computer and use it in GitHub Desktop.
No cache GB content fetch
function generateblocks_get_parsed_content( $content = '' ) {
if ( ! function_exists( 'has_blocks' ) ) {
return;
}
if ( ! $content && has_blocks( get_the_ID() ) ) {
global $post;
if ( ! is_object( $post ) ) {
return;
}
$content = $post->post_content;
}
$content = apply_filters( 'generateblocks_do_content', $content );
if ( ! function_exists( 'parse_blocks' ) ) {
return;
}
$content = parse_blocks( $content );
return $content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment