[wp-trac] [WordPress Trac] #59741: Public-facing content using Page template is not displaying (since Gutenberg plugin Version: 16.9.0)
WordPress Trac
noreply at wordpress.org
Thu Oct 26 05:01:28 UTC 2023
#59741: Public-facing content using Page template is not displaying (since
Gutenberg plugin Version: 16.9.0)
--------------------------+-----------------------------
Reporter: tdmarsol | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Themes | Version: 6.3.2
Severity: major | Keywords:
Focuses: |
--------------------------+-----------------------------
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
<?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 = $elements['pages'][ $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!
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59741>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list