Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* Check if the currently saved page password matches a specific page */
- function page_password_correct($page_id){
- if(isset( $_COOKIE['wp-postpass_' . COOKIEHASH] )){
- require_once ABSPATH . WPINC . '/class-phpass.php';
- $hasher = new PasswordHash( 8, true );
- $hash = wp_unslash( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] );
- $the_post = get_post( $page_id );
- return $hasher->CheckPassword( $the_post->post_password, $hash );
- }
- return false;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment