-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
do_shortcode in Block template loader functions #19278
Comments
related: #21397 Isn't the shortcode meant to be processed through |
Looks definitely like the same issue, yes. I thought this might be by design, given the fully new experience maybe shortcodes now are seen as defunct :) and hence created a request instead of bug report. Feel free to obsolete this here if #21397 will be addressing the same! |
I've closed #21397 as a duplicate, though it has some testing instructions, which may be useful. @TukuToi @carlomanf are you still experiencing the issue? We discussed it in a triage session on slack (https://wordpress.slack.com/archives/C02QB2JS7/p1597727370199700), though I have to say none of us attending were particularly familiar with the process of setting up a template. One person mentioned that it seemed to work ok when updating an existing template with a shortcode block, so I thought it'd be worth checking in with you to see if this is still a problem. |
This might be fixed because I see the code now does Unfortunately I do not have anymore the setup from back then but will check if I find time soon to re-test this to confirm it as solved (I highly suspect it is, given the code), however I can't guarantee it just yet. |
I just tested it with gutenberg 8.8 and wordpress 5.5, and the bug is half-fixed. When the shortcode is part of the post content, it now works correctly. When the shortcode is part of the template, the behaviour is unchanged since the report from #21397. |
I'm currently seeing the same behavior as described by carlomanf. |
I don't have the ability to close this, but I believe it was fixed with #37545. However, it appears that the fix has not propagated over to core yet so I expect there will need to be a mirroring patch for core. @TukuToi @carolinan @Mamaduka |
Thanks for the ping, @carlomanf. Yes, I believe the issue got fixed by the PR you mentioned. I'm not sure if we can backport the fix into core this late in the release cycle, but I left the comment in the PR. I will close this issue since the bug is fixed in the plugin. |
I'm currently seeing exactly that issue. The same shortcode works fine if it's part of the Example
|
@ecairol The issue you are looking for is https://core.trac.wordpress.org/ticket/56780 |
Thank you @carlomanf! |
Problem
The experimental feature of Gutenberg Block (plugin) "Full Site Editing" allows us to create Theme templates. However, when those templates are rendered, in
gutenberg_render_the_template
, it seems either intentionally or by accident, ShortCodes are not considered when building the$content
.As a result, if our Custom Template built with Gutenberg holds ShortCodes of any kind those won't execute but print as bare shortcodes on the front end.
Suggestion
I suggest, unless I miss something obvious, to
$content = do_shortcode($content);
beforeecho
ing it (or$content = apply_filters('the_content',$content);)
, around line 237 of/gutenberg/lib/template-loader.php
functiongutenberg_render_the_template()
There are (still) several cases when our templates (even if built with blocks) could contain ShortCodes.
Maybe I miss something obvious here, I am happy to stand corrected :)
The text was updated successfully, but these errors were encountered: