[wp-trac] [WordPress Trac] #35624: Use of get_comment() function shows Notice
WordPress Trac
noreply at wordpress.org
Wed Jan 27 15:44:13 UTC 2016
#35624: Use of get_comment() function shows Notice
--------------------------+------------------------------
Reporter: WisdmLabs | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Comments | Version: 4.4.1
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by boonebgorges):
Hi @WisdmLabs - Thanks for the ticket.
> When get_comment() (without parameter) is used, it returns nothing (not
even any warning, error or notice)
This is not entirely correct. When used without parameter, and the
`$comment` global is set, it will return the `$comment` object. Functions
like `get_comment_author_email_link()` - which you linked to above - are
designed to be used inside of comment template loops, where this global
will be set.
In what context are you calling `get_comment()` without a parameter? Are
you using `get_comment_author_email_link()` et al outside of a comment
loop? If so, what would you *expect* to happen? It seems to me that the
notice is a helpful reminder that you're doing something wrong.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35624#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list