WordPress 正常可以设置登录发表评论,但是在未登录的情况下也可以看到留言评论内容,可以简单修改一下让评论模块只有在登录的状态下可见,荒岛本次带来 WordPress 登录显示评论的教程,只要将下面的代码添加到主题的「functions.php」文件即可。
// 荒岛一座藏有宝藏的小岛 function ximagine_comments() { if (get_option('login_comment')) { if ( is_user_logged_in()){ if ( comments_open() || get_comments_number() ) : if ( get_option( 'sticky_comments' ) && get_option( 'comments_top' ) ) { be_sticky_comments(); } comments_template( '', true ); endif; } } else { if ( comments_open() || get_comments_number() ) : if ( get_option( 'sticky_comments' ) && get_option( 'comments_top' ) ) { be_sticky_comments(); } comments_template( '', true ); endif; } }宝藏内容来自荒岛-https://x-imagine.com/wordpress-login-to-show-comments-tutorial.html宝藏内容来自荒岛-https://x-imagine.com/wordpress-login-to-show-comments-tutorial.html
请按「Ctrl+D」收藏荒岛分享给好友,如您发现本文教程或宝藏链接已失效,请联系站长修正!
荒岛公众号
扫一扫关注

HDsoft27
公众号ID已复制,前往微信关注...
荒岛哔哩姬
扫一扫关注

ximagine
哔哩姬ID已复制,前往B站关注...