Skip to content
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

FSE templates not rendering shortcodes used in blocks #35258

Closed
Stiofan opened this issue Sep 30, 2021 · 9 comments · Fixed by #37545
Closed

FSE templates not rendering shortcodes used in blocks #35258

Stiofan opened this issue Sep 30, 2021 · 9 comments · Fixed by #37545
Labels
[Feature] Shortcodes Related to shortcode functionality [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Feature] Template Editing Mode Related to the template editor available in the Block Editor Needs Testing Needs further testing to be confirmed. [Status] Needs More Info Follow-up required in order to be actionable.

Comments

@Stiofan
Copy link

Stiofan commented Sep 30, 2021

Description

If a block output contains a shortcode it will be renedered when used in a page/post or block widget, however if used on a template such as single-post.html then the shortcode will not be rendered. The backend editor WILL render it, but the frontend will not.

Step-by-step reproduction instructions

I have a framework that serverside renders blocks as they are shortcodes. It can be installed as a plugin to test.
https://github.com/AyeCode/wp-super-duper

There is a "Hello World" example, add the example to a normal post and view the source code, you will see it's contens as a shortcode. If used on a single-post.html template it will render in the backend but not on the front end. I guess as it does not get put through "the_content" filter.

Screenshots, screen recording, code snippet

Untitled_.Sep.30.2021.1_42.PM.mp4

Environment info

WP 5.8.1
GB 11.6.0
Theme: armando (theme experiments)
Chrome
Ubuntu

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@carolinan carolinan added [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Feature] Template Editing Mode Related to the template editor available in the Block Editor labels Oct 10, 2021
@ianlin
Copy link

ianlin commented Dec 9, 2021

There is a similar findings that was reported in WordPress/twentytwentytwo/issues/280, but turns out it's more like the behaviour described in this issue.

@carolinan carolinan added the [Feature] Shortcodes Related to shortcode functionality label Dec 21, 2021
@Stiofan
Copy link
Author

Stiofan commented Oct 12, 2022

This issue is not actually solved by the above pull request. Can we re-open this?

@carolinan
Copy link
Contributor

carolinan commented Oct 13, 2022

Please include the full details about what, more precisely, is not working, and how to reproduce it without third party plugins.
If it can not be reproduced without third party plugins, it can not be excluded that the problem is within that plugin.

@carolinan carolinan reopened this Oct 13, 2022
@carolinan carolinan added Needs Testing Needs further testing to be confirmed. [Status] Needs More Info Follow-up required in order to be actionable. labels Oct 13, 2022
@bph
Copy link
Contributor

bph commented Nov 9, 2022

@Stiofan I tried to install the plugin from zip, and it ran into a 500 error.
@ agree with @carolinan, we need some updated steps for reproducing your issue without using a 3rd party plugin.

@justintadlock
Copy link
Contributor

justintadlock commented Nov 9, 2022

Edit no. 4: (sorry for the edits---been a while since I've tested shortcodes).

I have tested this with a custom shortcode and haven't been able to reproduce. I'd like to see more detailed steps too. Here's what I tried:

  1. Create a test shortcode in my theme's functions.php:
add_action( 'init', function() {
	add_shortcode( 'test', function() {
		return '<p>Hello, world</p>';
	} );
} );
  1. Used it within the Shortcode block in a theme template:
<!-- wp:shortcode -->
[test]
<!-- /wp:shortcode -->
  1. View output in the editor and front end:
<p>Hello, world</p>

@bph
Copy link
Contributor

bph commented Dec 8, 2022

With information still missing on how the PR #37545 is not working, I close this again.

@bph bph closed this as completed Dec 8, 2022
@hastinbe
Copy link

I'm having this exact same issue on 6.2.1 which according to this should've been fixed long ago. All shortcodes in our templates are being output as plaintext, but in the post content is working fine.

@carlomanf
Copy link

@hastinbe This is a very old ticket and has nothing to do with the recent 6.2.1 change. Please voice your concerns at https://core.trac.wordpress.org/ticket/58333 and leave this ticket archived.

@hastinbe
Copy link

hastinbe commented May 17, 2023

It does however have the same symptom, which is how I ended up here for those of us who searched the issues. But thanks for the link, I did find it earlier after I made that comment and I'm sure it will help others who end up here like I did

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Shortcodes Related to shortcode functionality [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Feature] Template Editing Mode Related to the template editor available in the Block Editor Needs Testing Needs further testing to be confirmed. [Status] Needs More Info Follow-up required in order to be actionable.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants