Can anyone suggest a solution...

4 replies
Hi All,

I've just installed a new WP theme (Glass) that looks great except for an irritating little error in single posts:

Fatal error: Call to undefined function: post_password_required() in /home/mysite.com/public_html/blog/wp-content/themes/glass/comments.php on line 5

appears at the bottom of the page and the sidebar is also missing.

I've included the first few lines of comments.php below:

<?php // Do not delete these lines
if (isset($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');

if ( post_password_required() ) { ?>
<p class="nocomments"><?php _e('This post is password protected. Enter the password to view comments.',"glass"); ?></p>
<?php
return;
}
?>

<!-- You can start editing here. -->

Any suggestions you could give would be great. I'm not a php fundi. i just basically muddle along testing and trying things to see how they work out. I haven't changed anything in this theme at all yet.

Thanks in advance for your help.
#solution #suggest
  • Profile picture of the author mywebwork
    Hi Hunter06

    The post_password_required() function is a native WordPress function, yet the error message is saying that it can't find it. The comments.php file is the file that called the function.

    Check to see that you have a /wp-includes/post-template.php file in your installation, this is where the post_password_required() function is defined. The function itself is defined on line 476.

    Aloha

    Bill
    {{ DiscussionBoard.errors[578942].message }}
    • Profile picture of the author Hunter06
      Thanks for the info Bill,

      It appears that although I have the /wp-includes/post-template.php file, the line you refer to is not there.

      Any further suggestions??
      {{ DiscussionBoard.errors[580512].message }}
  • Profile picture of the author mywebwork
    Hi Hunter06

    What version of WordPress are you running? This function was only implemented starting with version 2.7. Perhaps you are running an older version of WordPress?

    Bill
    {{ DiscussionBoard.errors[581840].message }}
    • Profile picture of the author Hunter06
      Yip, that was the problem.

      I've just upgraded to the latest version of WP and everything works fine. This is the first time I've tried upgrading so the DB backup and copying of all the files and images was a bit of a challenge but after following the detailed instructions it went very smoothly. It took about 30 minutes and is worth the effort.

      Thanks again for your advice and suggestions.

      Keep well,

      John
      {{ DiscussionBoard.errors[583022].message }}

Trending Topics