Shortcodes don’t work in patterns (reusable blocks)
-
Context: WordPress
I created a Gutenberg group block which includes a headline and a Simple Calendar shortcode. I tested the output and everything worked as expected.
Then I transformed the group block into a pattern (f.k.a. widget) and added this pattern block in another page template using the site editor.
Expected result
The headline and the calendar items from Google Calendar are shown wherever I use the template.
Actual result
The shortcode is shown instead of the calendar entries.
Additional information
JSON of the pattern
{ "__file": "wp_block", "title": "Upcoming events", "content": "<!-- wp:group {\"layout\":{\"type\":\"constrained\"}} -->\n<div class=\"wp-block-group\"><!-- wp:heading {\"fontSize\":\"large\"} -->\n<h2 class=\"wp-block-heading has-large-font-size\">Upcoming events</h2>\n<!-- /wp:heading -->\n\n<!-- wp:shortcode -->\n[calendar id=\"268\"]\n<!-- /wp:shortcode --></div>\n<!-- /wp:group -->", "syncStatus": "" }System information
WordPress Version: 6.4.3 Locale: de_DE Timezone: Europe/Berlin Multisite: No Permalinks: /%year%/%monthnum%/%day%/%postname%/ WP Memory Limit: 40 MB WP Debug Mode: keine Script Debug: keine Active Theme Theme Twenty Twenty-Four - 1.0 Child Theme: No Parent Theme: - Active Plugins Plugins Local Google Fonts: 0.22.0 Lightbox for Gallery & Image Block: 1.13 Spectra: 2.12.2 Fonts Plugin | Google Fonts Typography: 3.5.1 Simple Calendar: 3.3.0 Pretty Google Calendar: 1.7.1 Default featured image: 1.7.3 Backup-Migration: 1.4.2 Server Environment Server Environment Web Server: Apache/2.4.54 (Debian) PHP Version: 7.4.30 MySQL Version: 8.0.29 Server Timezone: UTC Display Errors: No Memory Limit: 256M Upload Max Filesize: 2M Post Max Size: 8M Max Execution Time: 30 Max Input Vars: 1000 fsockopen: Yes cURL: 7.74.0 OpenSSL/1.1.1n SOAP: No SUHOSIN: No WP Remote POST: Yes WP Remote GET: No (401) Client Information
-
Hi there,
Thanks for keeping in touch with us.
In this case, I have carried out tests on this and even converted the Group block to a pattern, added the pattern to a page and the calendar is actually rendered. Here is a screenshot: https://prnt.sc/Is2gh-aWH94A .
Based on the above, could you kindly try disabling other plugin you have in place and test this once again. If the issue is resolved, please reactivate the plugins one by one to identify the conflicting plugin.
Let us know how it goes.
Kind Regards
The topic ‘Shortcodes don’t work in patterns (reusable blocks)’ is closed to new replies.