WordPress

Posting a Comment Yields Blank/White/Empty Screen in WordPress

I wanted to set up a comments template even on pages that have no posts, such as the main site pages: Food, Web-Design, Pastimes, About, and I entered the following code at the bottom of each of these pages, but when I tried to post a comment, I got the white screen of death.

1
<?php comments_template( '', true ); ?>

I googled and tried many of the fixes offered for this problem to no avail, so I gave up and worked on other glitches. Periodically I would goolge and try again to find a solution, and again failed to solve the problem and went back to other issues. This went on for a number of weeks.

Finally, I ran out of glitches and had to face this problem head on.

Here’s what finally worked:

I wrapped this:

1
<?php comments_template( '', true ); ?>

With these:

1
2
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<?php </span> endwhile; ?>

To produce this:

1
2
3
<?php </span> if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    <?php </span> comments_template( '', true ); ?>
<?php </span> endwhile; ?>

Now it works – I Hope this helps you!

One thought on “Posting a Comment Yields Blank/White/Empty Screen in WordPress”

Leave a Reply