Opened 12 months ago
Last modified 6 months ago
#59741 new defect (bug)
Public-facing content using Page template is not displaying (since Gutenberg plugin Version: 16.9.0)
Reported by: | tdmarsol | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 6.3.2 |
Component: | Editor | Keywords: | reporter-feedback |
Focuses: | Cc: |
Description
I'm not sure if this is a Gutenberg plugin problem, or a Core problem (because the error is coming from wp-includes/post-template.php, so I am posting it here.
I updated the Gutenberg plugin this afternoon, and the public-facing content that uses the Page template is no longer appearing to the public. The title still displays to the public, and the content is still in the database and visible in the Admin area, but the Content block is not rendering properly to the public.
This is the error displayed at the top of my content pages:
Warning: Undefined array key -1 in /Users/[site-name]/Local Sites/vnb/app/public/wp-includes/post-template.php on line 330
Here's the relevant line of code on wp-includes/post-template.php
<?php $page_no = $elements['page']; $content = $elements['pages'][ $page_no - 1 ]; if ( preg_match( '/<!--more(.*?)?-->/', $content, $matches ) ) { if ( has_block( 'more', $content ) ) { // Remove the core/more block delimiters. They will be left over after $content is split up. $content = preg_replace( '/<!-- \/?wp:more(.*?) -->/', '', $content ); }
This line in the above code version is line 330: {{{#!php
<?php
$content = $elementspages?[ $page_no - 1 ];
}}}
When I turned the WP Debug to true, this is the error that displayed:
Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /Users/[site-name]/Local Sites/vnb/app/public/wp-includes/post-template.php on line 331
When I disabled the Gutenberg plugin, all of the error messages disappeared and the Content block resumed rendering properly to the public-facing side of the website pages.
Again, I am not sure if this is a core problem or a Gutenberg problem.
The content displayed properly when it was rendering through custom templates. This problem seemed to happen on pages that used the Page template.
Thank you!
Hi @tdmarsol I would like to ask if you are still experiencing this issue in the latest WordPress version, without Gutenberg installed?