Skip to content

Instantly share code, notes, and snippets.

@asharirfan
Last active January 1, 2016 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asharirfan/aad0df02601958a32305 to your computer and use it in GitHub Desktop.
Save asharirfan/aad0df02601958a32305 to your computer and use it in GitHub Desktop.
A function for WordPress. It returns true if comment is a parent and false it comment is a child.
<?php
/**
* Comment Parent Check
*
* Returns true if comment is a parent comment
* and false if it is child comment
*
*/
function aa_comment_parent($aa_comment_id) {
$aa_comment = get_comment($aa_comment_id);
$aa_comment_parent_id = $aa_comment->comment_parent;
if ( $aa_comment_parent_id == 0 ) : return true; else : return false; endif;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment