WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] pre_comment_approved hook manual telling wrong things. (5 posts)

  1. danyui
    Member
    Posted 1 year ago #

    Hi, maybe here is wrong place to write this post,
    but i found one wrong thing in codex manual.

    It's about pre_comment_approved filter which returns
    comment status. This page is writing that i can return 0 or false
    and 1 or true. but when i'm trying to return true or false value my comment disappears
    from my admin panel. Then i found my comments
    in "comments" table which "comment_approved" field is blank in the datebase.
    It works fine when i'm return 0 or 1 ,and dont work when i return true or false.
    If i'm wrong please tell me the reason.
    Thanks.

  2. danyui
    Member
    Posted 1 year ago #

    sorry here is link

  3. danyui
    Member
    Posted 1 year ago #

  4. bcworkz
    Member
    Posted 1 year ago #

    You're right, it's misleading. According to the parameters section, $approved should only be set to 0, 1, or 'spam'. This is correct. The part under return values was trying to be helpful by assigning logical labels to the 1 and 0 return values, but ends up being confusing. No one should be returning true or false values, only 0 or 1 or 'spam'.

    I'll see if I can do the edits without offending anyone. Thnks for pointing this out.

  5. danyui
    Member
    Posted 1 year ago #

    Thanks for answer and fixing the codex page!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags