Support » Fixing WordPress » Comment Moderation Issue – need help

  • Resolved housebg


    I have setup the comment moderation to require an admin to approve all comments. But if I am logged in as the author of a post, and make a comment on that post – it is getting automatically approved.

    This is for a specialized site, where we have users that are set with the Role of Contributor and assigned as authors to (1) unique custom post type, which acts as a business listing. They can then comment and interact with customers, and we highlight their comments as the author. But, they aren’t allowed to solicit business away from the site, so we need to moderate their comments and make sure they aren’t sneaking in website links or phone numbers and emails.

    Shouldn’t setting the “An Administrator must always approve a comment” ensure that all comments have to be moderated? What could be overriding this?

    We were set to go live on Monday, and I did some last testing just to be safe and discovered this problem – so we’re a little desperate.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Krishna



    Try using the check box where it says ‘Before a comment appears (check box here) An administrator must always approve the comment‘.

    I did that, that’s why I’m confused. If the author of the post is logged in and comments, it’s completely bypassing this requirement.
    I looked in comment.php, and that is the first check so it should be returning false and not allowing the comment to go live. But it isn’t being moderated.

    Other comments from visitors that are not the author get moderated.

    What in the world could be causing this?




    Try resetting the author’s role as contributor or editor and see what happens.

    Thanks Krishna for trying to help. These users as Contributors as their Role. We set them as the author on the post in the admin, but they are still contributors.

    Mostly, I’m looking to understand why the “An Administrator must always approve the comment” does ALWAYS work. Is there a loophole here?




    No, it is not a loophole, but how you restrict or allow certain things.

    However, glad to see that you resolved the problem.

    Actually, it’s not resolved at all – sorry if I gave that impression.

    Here’s what we have…
    1 Administrator, which is me as the developer
    1 Editor, which is the site owner
    up to 60 Contributors. These are the business owners that have one of these listings on the site.

    I use a combination of Adminimize and custom code functions to limit who has access to what.

    I had this working before, and when one of the business owners logged in and made a comment, it was being moderated. I’m not sure what changed, and unsure how it could change from my reading. The “must always approve” is where I’m stumbling…

    Is it “the administrator must always approved – unless it’s one of these conditions that’s built into WordPress that you may not know about” 🙂

    All joking aside – always means always to me – so why are these comments being sent through instead of held in moderation? Again, it’s logged in users – not guests. Does logging in bypass the “adminstrator must always approve”? If it does, how do I change this functionality? Is there a filter I can use to make always = ALWAYS ?




    Perhaps this helps:

    Also note that your custom settings can override some of the settings, or can cause setting conflicts that cause problems.

    Appreciate the link, but I was already over there double-checking role capabilities. I understand that customization can cause problems – what I’m looking for here is an explanation of what circumstances can case the “ALWAYS” to be overridden.

    If someone can tell me when always gets bypassed, then I can start going through code and various plugins to see what’s mucky up the process. But the codex says this is ALWAYS, and the code in comment.php is pretty specific to check for this flag first and then break out.

    It would seem, therefore, that every comment would be held for moderation – but it’s not. So I need to understand when this always can be overrulled – what kinds of circumstances, etc. Otherwise, I’m shooting in the dark here without any kind of idea where the problem could be.

    Make sense?




    Yes. But I think you need to have a look at wp-comments-post too where the conditions are set, for instance, if the user is logged in, etc.

    I’m getting closer, but still stumped. If the logged in contributor comments on a post that they are NOT the author of, the comment goes into moderation like it should.

    But if they comment on their own post – it’s automatically approved.

    I there a filter or function I can use to stop that behavior and make their comments be moderated, even if they are author of the post?

    Okay, I solved it – so I’m going to document in case anyone else has this problem.

    There is a pre_comment_approved filter, so I used that to add a function that forces every comment to be moderated, including ones that the author of a post makes on their own post.

    add_filter('pre_comment_approved', 'xko_pre_comment_approved', null, 2);
    function xko_pre_comment_approved($approved, $commentdata)
        $approved = 0;
      return $approved;

    Housebg, you’re my hero! 🙂

    I spent quite a while searching for a solution for this and I posted question here but never got a reply.

    Anyways, thanks for doing the hard work! I just tried it on a website I’m developing for a school it works great!!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Comment Moderation Issue – need help’ is closed to new replies.