WordPress函数:comments_link 显示指向当前帖子评论的链接

江河/ 2023年06月15日/ WordPress/ 浏览 1289

函数原型:


comments_link( string $deprecated = '', string $deprecated_2 = '' )


显示指向当前帖子评论的链接。


参数说明:


$deprecated 和 $deprecated_2 两个参数都已经没用 了。


函数源码:


function comments_link( $deprecated = '', $deprecated_2 = '' ) {
	if ( ! empty( $deprecated ) ) {
		_deprecated_argument( __FUNCTION__, '0.72' );
	}
	if ( ! empty( $deprecated_2 ) ) {
		_deprecated_argument( __FUNCTION__, '1.3.0' );
	}
	echo esc_url( get_comments_link() );
}


使用举例:


<a href="<?php comments_link(); ?>">
    Comments to this post
</a>


发表评论

暂无评论,抢个沙发...

客服 工单