Support » Fixing WordPress » errors when leaving comments

  • I’ve had several people let me know that they get the following error when leaving comments:

    Error: This file cannot be used on its own.

    The site is:

    In the two cases where I know the browser – it was firefox.

    I have not been able to replicate the issue in firefox or IE. the people having problems have sometimes been able to post a comment if someone else already has.

    any ideas? I couldn’t find anything in older posts or on the web – except one issue related to pop-up comments.

    thank you.

Viewing 15 replies - 1 through 15 (of 28 total)
  • i don’t know how to help but i’m having the same problem! did you find anything out? someone help us please 🙂

    i found the text, but i don’t know what this means-

    if (!$_SERVER[‘HTTP_REFERER’] == dirname(__FILE__) . ‘/wp-comments.php’)
    die (‘Error: This file cannot be used on its own.’);
    /* Don’t remove these lines. */
    $blog = 1;
    require (‘wp-blog-header.php’);
    add_filter(‘comment_text’, ‘popuplinks’);
    foreach ($posts as $post) { start_wp();

    I am having the same problem on WordPress 1.5.

    “Error: This file cannot be used on its own.”

    Just left a comment with the pink blog as a test. No error. Also with Jons Blog. No error there, either. 🙁 Sorry, guys.

    Yeah, we can’t recreate the errors because it’s only coming from SOME people. but thanks for the help.

    I’m seeing this error as well on the fiancee’s blog at I get the error in IE6 SP2 under Windows XP SP2 on two different PCs (one is an actual PC, the other is a Virtual PC under MacOS X). The fiancee also gets the error from work under Win2k in IE5.5 (she thinks that’s the IE version, anyway). And one of her users mentioned it to her, which is how we found out in the first place (unknown OS and browser).

    Safari 1.2.4, FireFox 1.0, and IE 5.2 on the Mac exhibit no problems. Similarly, FireFox 1.1 on the PC has no problems. But every time I try to click on any comment link in IE6 in XP, I get the “error: file cannot be used on its own” message. This includes posts that already have a comment or two posted, FWIW.

    Is there a recent update to IE for the PC that would cause pop-up comments to go AFU? A security setting, perhaps?

    I’ll have access to a few more machines at the university tomorrow – I’ll see if I get the error from there as well.


    I only get the error when I try to post comments to other friends WP blogs that are a newer version. I have an older version of WP and have no problems commenting and no one has ever told me that they get that error. I have tried numerous friends blogs in numerous browsers and get that blasted error message and it is driving me insane quite frankly.


    I have been able to narrow this down a bit. I should say from the start that I know nothing of PHP and very little about HTML… but working from the code around the error message:

    if (!$_SERVER[‘HTTP_REFERER’] == dirname(__FILE__) . ‘/wp-comments.php’)

    I figured that the referer request header might be involved here.

    In Opera you can easily enable/disable sending that header. With the referer header enabled, I get no error message. With the header disabled, I get the error every time. Tested in Opera v8.0 on the Mac and v7.54 on Windows.

    I’d love it if others could reproduce that result, just to make sure it’s nothing wacky on my end.

    Using the steps outlined at however, does not eliminate the error in IE6 for Windows. The Windows machines are running XP SP2 and there’s no security software – even the Windows firewall is disabled.

    Any ideas from the gurus? I can’t figure out how to enable sending the referer in IE.


    Any ideas anyone? One of my friends is getting the same error.

    So far I’ve gotten that this is a problem with the referer header. Is it located in the popup comments file? If so… why is the error showing up for regular comments (no popup)?

    I’m only seeing the issue when popup comments are enabled. With popup comments commented out, there’s no problem. That’s been the temporary fix for the fiancee’s blog (disable popup comments) since I can’t very well tell her users they must use Opera.

    So what would happen if I just commented out these lines in wp-comments-popup.php:

    if (!$_SERVER[‘HTTP_REFERER’] == dirname(__FILE__) . ‘/wp-comments.php’)
    die (‘Error: This file cannot be used on its own.’);

    As I said before, I know precisely jack about PHP. What’s the purpose for these lines? Is using the referer header merely an anti-spam device, or does it serve a larger purpose? Is the error message really caused by the referer header being not present (or malformed somehow) or does it just look that way?

    The same lines appear in wp-comments-post.php… would I have to remove them from there as well?

    More to the point, will I be crushed by a huge foot (Monty Python animation-style) if I just sorta remove those lines and see what happens?


    Hey, there.

    One of my important visitors had this same problem with the “Error: This file cannot be used on its own.” We spent days trying to get around it and nothing seemed to work.

    Finally, we attempted to post after SHUTTING DOWN NORTON ANTI-VIRUS. It worked like a charm. Now, this is not, in any way, a permanent fix, but it does give us the next step to investigate. Is there something is anti-virus software that causes referer headers to be sent or not? I’d like to find out so I can ensure ease of use for my site. Every visitor is precious, you know. Feel free to stop by and take a looksie yourself.

    Has there been any movement on this? A definate cause / solution been found?

    I’ve got a friend running WordPress 1.5 that I set up for him and he was just told by one of his site visitors that the error is coming up when this site visitor tried to comment.

    The site is . He’s using pop-up comments….

    I think that particular bit of code is there to prevent spam bots from leaving comments, since they won’t show the necessary referrer information. So if the tradeoff is that some nonstandard browser configurations (my Firefox works fine) can’t leave comments, I wouldn’t mess with it.

    I found that this error only occurs when I disable referrer logging on Opera 8.01

    I hope this helps.

    It’s part of Norton’s privacy features to disable your browser to send certain information from your machine.

    If the site U leave from or go to rely on this information and has bad coding (to avoid the error if not found) U get the actual error.

    So, the problem lies within the code of the page that faults (partly), Norton default privacy settings or U have manually disabled your browser to send the information needed by the blog to complete its tasks.

Viewing 15 replies - 1 through 15 (of 28 total)
  • The topic ‘errors when leaving comments’ is closed to new replies.