How to lock a post or page

You can use the ‘wp_insert_post_data’ filter to set the data being updated to the ones post has right now: add_filter(‘wp_insert_post_data’, ‘prevent_post_edit’, 99, 2); prevent_post_edit ($data, $postarr) { if ( ! isset($postarr[‘ID’]) || empty($postarr[‘ID’]) ) return $data; if ( current_user_can(‘edit_files’) ) return $data; // admin can edit posts // prevent the update only for post and … Read more

Importing Existing Users with Passwords

You can use wp_insert_user. Since your old database has passwords in base64, you can easily get the original password string using base64_decode. $new_user_data = array( ‘user_pass’ => ‘password’,//pass your decoded password string ‘user_login’ => ‘username’,//pass your username ‘user_email’ => ’email’, ‘first_name’ => ‘firstname’, ‘last_name’ => ‘lastname’, ‘role’ => ‘author’//if you want to specify a different … Read more

User password field is empty

I still wouldn’t recommend this because it is probably exploitable somehow… Technically assuming all the right hooks and functions are called, a user should not be able to login if supplying a blank password even if the user_pass field in the database is empty. Why…? When you try to login using the form as seen … Read more

Add error message on password protected pages

Here’s a combination of these two great answers (21697 & 71284) to similar questions. wpse241424_check_post_pass() runs early on the wp hook on single password protected pages. If an invalid password is entered, the INVALID_POST_PASS constant is set for use later in the form, and the password entry error cookie is removed to prevent the error … Read more

Is there a way to have admins that are logged in to wordpress not have to enter the password for password protected pages while browsing the website?

Since 4.7 you can filter the post_password_required function: function my_admins_dont_need_password( $required ) { if ( current_user_can( ‘manage_options’ ) ) { $required = false; } return $required; } add_filter( ‘post_password_required’, ‘my_admins_dont_need_password’ ); Replace manage_options with whatever capability you want to use to allow users to skip the password form.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)