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 Rendering Issue After WordPress Update with block_template_part() #58727

Closed
IonPulbere opened this issue Feb 6, 2024 · 4 comments
Closed
Labels
[Block] Template Part Affects the Template Parts Block [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed [Type] Bug An existing feature does not function as intended

Comments

@IonPulbere
Copy link

Description

Hi,

We recently performed an update on our WordPress website to the latest
version, 6.4.3. However, we have encountered an issue where the shortcodes
are not rendering as expected.

This problem specifically arises when the shortcodes are added in the
block template and an attempt is made to display them using
block_template_part(). It's worth mentioning that the shortcodes were
rendering successfully on WordPress version 6.2.

See images attached:
1)WP 6.4.3 - wp6 4 3
2)WP 6.2 -wp 6 2 - ok

Could you please investigate and provide a solution for this issue at your
earliest convenience? Your prompt attention to this matter would be highly
appreciated.

Thank you for your assistance.

Best regards,
Ion

Step-by-step reproduction instructions

  1. Create a custom template part, for example, "my-dash.html" on the path (\wp-content\themes\twentytwentyfour\parts\my-dash.html)
  2. In the WordPress backend, access /wp-admin/site-editor.php
  3. Navigate to "Patterns/Manage all templates part."
  4. Select the "My Dash" template part.
  5. Add a shortcode element (add any desired shortcode)
  6. In the theme files, call the template part from a custom PHP file using block_template_part("my-dash"). For example, I used the following file path: \wp-content\themes\twentytwentyfour\woocommerce\myaccount\dashboard.php.

Screenshots, screen recording, code snippet

wp6 4 3
wp 6 2 - ok

Environment info

WordPress Version - 6.4.3
Active Theme: Twenty Twenty-Four Version: 1.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

@IonPulbere IonPulbere added the [Type] Bug An existing feature does not function as intended label Feb 6, 2024
@Mamaduka
Copy link
Member

Mamaduka commented Feb 6, 2024

Thanks for creating the issue, @IonPulbere.

I believe this is a duplicate of https://core.trac.wordpress.org/ticket/56780. Core PR - WordPress/wordpress-develop#3851.

@Mamaduka Mamaduka added the [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed label Feb 6, 2024
@jordesign jordesign added the [Block] Template Part Affects the Template Parts Block label Feb 6, 2024
@Mamaduka Mamaduka closed this as not planned Won't fix, can't repro, duplicate, stale Feb 17, 2024
@srokatonie
Copy link

@IonPulbere This is not fixed - can you confirm with the newest Wordpress?

@srokatonie
Copy link

For anyone struggling this may work for you:

add_filter('render_block_core/shortcode', function(string $block_content): string {
    return do_shortcode($block_content);
}); 

@editandpost
Copy link

add_filter('render_block_core/shortcode', function(string $block_content): string {
return do_shortcode($block_content);
});

Worked for me. THANK YOU!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Template Part Affects the Template Parts Block [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

5 participants