Alphabetical comment search with get_comments()
As you search for posts alphabetically, you can also search for comments alphabetically. Pass an argument ‘search’ with a value that you want the comments to be searched for to the ‘get_comments’ function and you’re done!
Example:
$comments = get_comments(array(‘search’ => ‘z’));
The $comments variable will contain all the comments which have the alphabet ‘z’ in their content.
Simple ehh?
Issued in developer interest by Rutwick.
Gagan 5:54 pm on April 21, 2012 Permalink | Log in to Reply
Its not just search, it also accepts these arguments also, in case anyone might need someday :
‘author_email’ => ”,
‘ID’ => ”,
‘karma’ => ”,
‘number’ => ”,
‘offset’ => ”,
‘orderby’ => ”,
‘order’ => ‘DESC’,
‘parent’ => ”,
‘post_ID’ => ”,
‘post_id’ => 0,
‘post_author’ => ”,
‘post_name’ => ”,
‘post_parent’ => ”,
‘post_status’ => ”,
‘post_type’ => ”,
‘status’ => ”,
‘type’ => ”,
‘user_id’ => ”,
‘search’ => ”,
‘count’ => false
I’ve been deep studying these codes for the past three days(for implementing commenting from some other site in my project), so came across these facts