wpseek.com
WordPress开发者和主题制作者的搜索引擎
_get_comment_reply_id is private and should not be used in themes or plugins directly.
_get_comment_reply_id › WordPress Function
Since6.2.0
已弃用n/a
› _get_comment_reply_id ( $post = null )
| 访问: |
|
| 参数: |
|
| 返回: |
|
| 定义在: |
|
| 文档: |
Gets the comment's reply to ID from the $_GET['replytocom'].
Related Functions: get_comment_reply_link, get_comment_id, comment_reply_link, get_cancel_comment_reply_link, get_comment_guid
源码
function _get_comment_reply_id( $post = null ) {
$post = get_post( $post );
if ( ! $post || ! isset( $_GET['replytocom'] ) || ! is_numeric( $_GET['replytocom'] ) ) {
return 0;
}
$reply_to_id = (int) $_GET['replytocom'];
/*
* Validate the comment.
* Bail out if it does not exist, is not approved, or its
* `comment_post_ID` does not match the given post ID.
*/
$comment = get_comment( $reply_to_id );
if (
! $comment instanceof WP_Comment ||
0 === (int) $comment->comment_approved ||
$post->ID !== (int) $comment->comment_post_ID
) {
return 0;
}
return $reply_to_id;
}