简体   繁体   中英

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. 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. That would be more complex though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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