1

The goal is to easily allow for larger entities/clients to review content without having to have a user login/account for every project stack holder involved by providing a single URL to the final draft of the page/post for review and or approval.

We want to make/find a plugin that will let people view a "privately published" page from a unique URL... so it would be similar to like file sharing services like dropbox where you can send a private coded link like www.somewebsite.com/?page=76&code=an30f90sk30ifkas0fsd9f9sf ...

If you have this code and it is correct then you don't need to login to the website in order to view the page. Once the page is set to private and published we would show the public "link" where a user could copy and paste that for clients to review/etc...

We have not been able to find a plugin that will do this for us and so we want to build something but want to get some advice on direction options or functions we might want to look at.

1 Answer 1

1

You can actually hook the built-in page/post password feature and set it up to check for url params that match page/post password, and then change the value of $required to false.

add_filter( 'post_password_required', 'my_allow_url_param', 10, 2 );

function my_allow_url_param( $required, $post ) {

    if ( empty( $post->post_password ) ) {
        $required = false;
         return $required;
    }

    if ( $_GET['code'] == $post->post_password ) {
       $required = false;
    }
    return $required;
}

If you had a page with the slug of /sample-page/ and in the admin set a password of Cf5aTgZqBz5h6g1y858eQmpTWizzHzZN in the visibility setting on edit screen of that page, you could access it without logging in or typing a password with the following url:

http://sitename.com/sample-page/?code=Cf5aTgZqBz5h6g1y858eQmpTWizzHzZN

1
  • awesome will try this and get back to you :) thank you so much!
    – Amber Lynn
    Commented Aug 2, 2017 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.