Get Wordpress block templates content similar to $post_content #63760
Unanswered
archiveofwork
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
get_block_templates()
gets all block_templates on the site, but I just want the ones that are loaded for the current page.I'm trying to check if there is a shortcode inside one of the Gutenberg site-editor templates. It's not saved in
$post_content
or$template
.This works to check every single one
But I only want to check what loads on the page.
I saw query monitor plugin does output the main block template under the tab templates > block template
This is the query monitor code that outputs the correct template and seems to get its id:
I was able to reverse QAs solution to output the template content but this is not ideal:
$post_content outputs everything easily. How can I get the gutenberg site created page content in a simply way like that instead of the solution I have?
get_block_template()
would work perfectly but I need a simple way to get the template id outside of my monster of a solution.Beta Was this translation helpful? Give feedback.
All reactions