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
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
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
Hi Peter - Thanks for the reply.
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!
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
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.
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.
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_shortcode. But this order was changed in these 2 commits:
So the order now is
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):
So, when parsing the a block template, the MB Views shortcode is parsed first (via
do_shortcode), and then is applied
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.