Skip to main content
 Web开发网 » 站长学院 » Wordpress教程

如何保护WordPress网站?

2021年07月14日6820百度已收录

将下面的代码加到你的当前主题的functons.php的适当位置: function coolwp_filter_password_protected_post_excerpt( $content ) { if ( post_password_required() ) $content = '这个页面或者文章受密码保护,请输入密码查看摘要内容.'; return $content;}add_filter( 'the_excerpt', 'coolwp_filter_password_protected_post_excerpt' );add_filter( 'the_content', 'coolwp_filter_password_protected_post_excerpt' ); 即可确保你的摘要和文章内容都不会在文章列表页和文章详情页被非法查看,如果更完善的想保护自己的内容,Access Level Pro是不错的选择。

评论列表暂无评论
发表评论
微信