联系我们
简单又实用的WordPress网站制作教学
当前位置:网站首页 > WordPress教程 > 正文

How to hide the grout in WordPress cycle

作者:98wpeu发布时间:2024-01-25分类:WordPress教程浏览:81


导读:WordPress允许您创建受密码保护的种子。最近,我们的一位读者问,是否有可能对网站隐藏受密码保护的帖子。在默认情况下,WordPress会隐藏受密码保护的种子的内容,但它仍然会...

WordPress允许您创建受密码保护的种子。最近,我们的一位读者问,是否有可能对网站隐藏受密码保护的帖子。在默认情况下,WordPress会隐藏受密码保护的种子的内容,但它仍然会显示带有'Protected'前缀的种子标题。在本文中,我们将向您展示如何在WordPress环中隐藏受密码保护的种子。

Why do you have to hide the prout in WordPress?

在默认情况下,WordPress会显示受密码保护的种子、标题和前缀均为“Protected”。用户需要输入密码才能查看帖子的内容。

这篇文章的标题可以在主页、档案、最近发布的帖子小工具等上看到。如果你想让一些内容完全保密,那么这不是一个理想的选择。

没有密码的用户不仅可以看到帖子标题,他们还可以尝试输入密码。众所周知,密码是可以被破解的。

话虽如此,让我们来看看如何从WordPress循环中隐藏受密码保护的种子,以便其他用户看不到它们。

在WordPress中隐藏受密码保护的种子

The results showed that the mechanical properties of the mechanical properties.

You can still visit the prout by directing the URL to the prout.

上面的例子向所有用户隐藏了受密码保护的帖子。In this paper,we study the relationship between the factors of the

只需使用另一个条件标记修改上面的代码,如下所示:

function wpb_password_post_filter( $where = '' ) {
   if (!is_single() && !current_user_can('edit_private_posts') && !is_admin()) {
        $where .= " AND post_password = ''";
    }
    return $where;
}
add_filter( 'posts_where', 'wpb_password_post_filter' );
由❤️托管WPCode
在WordPress中一键使用

在本例中,我们检查用户是否不能编辑受密码保护的帖子,然后只显示没有密码的帖子。这样做,所有具有管理员和编辑用户角色的用户都将在您的站点前端看到受密码保护的帖子。

我们希望这篇文章能帮助您隐藏受密码保护的种子,防止WordPress出现循环在您的网站上。You may also want to look at our tutorial,about how to change private and to be protected in WordPress.

和Google+.

标签:密码保护帖子如何在WordPress


WordPress教程排行
最近发表
网站分类
标签列表