Support Forum
Hello, I'm having a new issue that might be related to WP core updates. Inside of a View, when I have an empty line in the CSS, the <style>
element output will contain paragraphs <p>
Here's an example image: https://cln.sh/C8ltv8fS
Removing line breaks in the CSS does resolve the problem, but previously the line breaks did not cause a problem. I'm not sure when this started but I know it started within the past 3 months.
I am currently on:
WordPress Version 6.2.2
Meta Box Version 5.7.1
Meta Box AIO Version 1.20.3
Looks like it's happening on Javascript code too: https://cln.sh/CwJkMz3b
Hello,
Can you please share a screenshot of the CSS code in the view area? I do not see that issue on my demo site, screenshots
Backend: https://monosnap.com/file/xDDz911PpwHKDlJpJ5x87pjMOn7Rjz
Frontend: https://monosnap.com/file/I7mWRYSpphUN4C2LM2vxGXLEIyT4E4
Hi Peter - Thanks for the reply.
Here are a couple screenshots...
Backend: https://cln.sh/xBT8XnWg
Frontend: https://cln.sh/y5P0j9d8
I'm having this problem on a few sites. But I have a couple sites that are not having this problem. So my next guess is that it might be a conflicting plugin or theme issue. I will check into that next.
But if you have any other ideas, let me know. Thank you!
Hello,
Ok, please try to disable all plugins except Meta Box, MB AIO and switch to a standard theme of WordPress then check this issue again.
Let me know how it goes.
Hi Long & Peter-- I can confirm and add a little more info...
* Using the plain WP Twenty-Twenty-Two theme and only Meta Box & AIO enabled
* When MB View shortcode is placed in a template using full site editor
* any line breaks in CSS or JS inside the MB View get wrapped in paragraph P tags
Screenshot of the View CSS: https://cln.sh/5JNmwclk
Screenshot of the rendered html: https://cln.sh/gHYQNqVT
If the shortcode is used inside another View or placed in a post using block editor, it works correctly. The bug only happens when the short code is added to a template (Single, Archive) or template part (Header, Footer)
So far, I have noticed this issue on at least 6 sites. All are using the latest versions of Meta Box and AIO. Some sites are on WP v6.1.3 and some are WP v6.2.2. All are using FSE Block Themes, but the theme doesn't seem to make a difference: some are using the Twenty Twenty Two, some Twenty-Twenty-Three theme or other FSE themes.
Also, I think this change happened sometime before May 24, that's when my client first noticed the styles not loading. But it might have happened a long time before that.
Hello,
I can reproduce the issue with the FSE (Full Site Editing). I've escalated this issue to the development team to fix this issue in the next update.
Hi Brandon,
Thanks for your feedback. After investigating, I found that there was a change in WP:
Previously, the block template was parsed in the following orders: do_blocks
, then shortcode_unautop
, then do_shortcode
. But this order was changed in these 2 commits:
https://github.com/WordPress/WordPress/commit/6a077b35f15590a843ff8a6c97a135f3a34872dd
https://github.com/WordPress/WordPress/commit/2bb3a5169548d16173cf48ca9da1111efc428f86
So the order now is shortcode_unautop
, do_shortcode
, then do_blocks
.
The problem is that the MB Views shortcode in the block template is the core/shortcode
block, which applies wpautop
(I have no idea why do they do that):
https://github.com/WordPress/WordPress/blob/master/wp-includes/blocks/shortcode.php
So, when parsing the a block template, the MB Views shortcode is parsed first (via do_shortcode
), and then is applied wpautop
(via do_blocks
with core/shortcode
block), and that causes the problem. Previously, they do_blocks
first, and then do_shortcode
, then it didn't happen.
As this is in the WordPress core, e.g. after the content of views are rendered, I think the only way to resolve it is removing line brakes in the plugin. This is what I'll do in the next version, so you don't have to do that manually.
After doing some research, I found that this is a big issue in WP itself, and is still being discussed!
Hi, i have a problem that I think is related to this: line breaks in the template tab appear as "<br>" in the generated HTML for the page.
{% for key, term, url in terms %}
{{ term.name }}
{% endfor %}
==>
<a class="GC_etiqueta_localizacion" href="https://qqqq.com/loc/abrucena/">Abrucena</a><br>
Adra<br>
Sorry for the formating...
{% for key, term, url in terms %}
<a class="GC_etiqueta_localizacion" href="{{ term.url }}">{{ term.name }}</a>
{% endfor %}
results in
<a class="GC_etiqueta_localizacion" href="https://qqq.com/loc/abrucena/">Abrucena</a><br>
<a class="GC_etiqueta_localizacion" href="https://qqq.com/loc/adra/">Adra</a><br>