_get_comment_reply_id

函数
_get_comment_reply_id ( $post = null )
Access
Private
参数
  • (int|WP_Post) $post The post the comment is being displayed for. Defaults to the current global post.
    Required:
    Default: null
返回值
  • (int) Comment's reply to ID.
定义位置
相关方法
get_comment_reply_linkget_comment_idcomment_reply_linkwp_comment_replyget_comment_guid
引入
6.2.0
弃用
-

_get_comment_reply_id: 这是一个WordPress的内部函数,用来检索一个给定评论的评论回复ID。它被用来生成显示在每个评论下面的 “回复” 链接的HTML。

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;
}

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2026-01-29 08:09:34

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: