Possible problem with WordPress 6.0.1
-
I’m not 100% certain at this point whether this is an incompatibly between WordPress 6.0.1 and Custom Error Pages 1.1 or if it’s caused by my theme or 34 other plugins…
But basically, the error pages stopped rendering (sometime in the last month – but WP has had a couple of updates since then). My theme used to be able to display the title and the content of the error pages using /content-page.php and code similar to:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php the_title('<h1>','</h1>') ?> <?php the_content(); ?> <?php endwhile; endif; ?>
but it stopped working and just rendered an empty title and content section (the theme itself continued to work as expected).
To get it to work, I had to modify the above to be something like:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php global $post; if (($post instanceof WP_Post) && (1===preg_match("/^\d{3}-error-\d{4,}$/",$post->post_name))) : ?> <h1><?php echo $post->post_title; ?></h1> <?php $content=$post->post_content; $content=apply_filters('the_content',$content); $content = str_replace( ']]>', ']]>', $content ); echo $content; ?> else : <?php the_title('<h1>','</h1>') ?> <?php the_content(); ?> <?php endif; ?> <?php endwhile; endif; ?>
`
Anybody else having this problem with WordPress 6.0.1?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Possible problem with WordPress 6.0.1’ is closed to new replies.