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

Shortcode Block not working in Synched Pattern in Template #68214

Open
3 of 6 tasks
krokodok opened this issue Dec 20, 2024 · 2 comments
Open
3 of 6 tasks

Shortcode Block not working in Synched Pattern in Template #68214

krokodok opened this issue Dec 20, 2024 · 2 comments
Labels
[Block] Shortcode Affects the Shortcode Block [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) [Type] Bug An existing feature does not function as intended

Comments

@krokodok
Copy link
Contributor

Description

The Shortcode Block does not parse shortcodes when used in Synched Patterns in Block Editor Page Templates.

Step-by-step reproduction instructions

  1. Go to a blank page and insert the Shortcode Block into the content. I used this shortcode for testing: [caption]Caption[/caption]
  2. Duplicate the block and transform it to a Synched Pattern.
  3. Go to the frontend and observe both blocks working from inside the page content.
  4. Now cut both blocks to the clipboard and navigate to the page template. Insert the blocks somewhere.
  5. Go to the frontend and observe only the block working, that it is not a Synched Pattern. The other displays the raw shortcode content without rendering.

Screenshots, screen recording, code snippet

Image Image

Environment info

I used WordPress Playground with theme Twenty Twenty-Five, WordPress version 6.7.1 and Php 8.0.

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

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure
@krokodok krokodok added the [Type] Bug An existing feature does not function as intended label Dec 20, 2024
@Rishit30G
Copy link
Contributor

I can confirm that the issue is there, sharing a screencast:
https://github.com/user-attachments/assets/b7b31ae6-0819-46e2-88c2-802775147d52

@t-hamano t-hamano added the [Block] Shortcode Affects the Shortcode Block label Dec 22, 2024
@talldan talldan added the [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) label Dec 23, 2024
@talldan
Copy link
Contributor

talldan commented Dec 23, 2024

You can add the shortcode to a template part instead of a synced pattern to work around this.

I think shortcode processing was never added to synced patterns (or before that reusable blocks) as they were more commonly added to posts, and the code that renders a post already performs shortcode processing on behalf of all the blocks within the post.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Shortcode Affects the Shortcode Block [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

4 participants