简体   繁体   English

允许来自特定链接的用户查看WordPress中的私人帖子

[英]Allow users coming from a specific link to see private posts in WordPress

I have a WordPress blog (self-hosted) and I want the users coming from a link like my-wordpress.com/see?pass=0cc175b9c0f1b6a831c399e269772661 to see private posts as if they were registered. 我有一个WordPress博客(自托管),我希望用户来自像my-wordpress.com/see?pass=0cc175b9c0f1b6a831c399e269772661这样的链接,以查看私人帖子,好像它们已经注册一样。 Is that possible? 那可能吗? How do I achieve that? 我该如何实现? Thank you 谢谢

This isn't a great way of doing things, but if you really want to handle it like this, you would simply need to validate the "pass" data against whatever your password is on the "private website." 这不是一个很好的处理方法,但是,如果您真的想这样处理,您只需要根据“私人网站”上的密码来验证“通过”数据即可。 Something like... 就像是...

<?php
$myPass = '0cc175b9c0f1b6a831c399e269772661';
if ($_GET['pass'] == $myPass) {
   // Correct!
} else {
   // Wrong
}
?>

Edit: Ideally you would have a piece of software that validates the code at entry and creates a wordpress session for the user. 编辑:理想情况下,您将拥有一款可以在输入时验证代码并为用户创建wordpress会话的软件。 That would be more complex though. 不过那会更复杂。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM