Password protected post or page – error message by wrong password?

not really, but can try something like: add_action(‘wp’, ‘check_post_pass’); function check_post_pass(){ if(!is_single() || !post_password_required()) return; global $post; if(isset($_COOKIE[‘wp-postpass_’.COOKIEHASH]) && $_COOKIE[‘wp-postpass_’.COOKIEHASH] !== $post->post_password){ define(‘INVALID_POST_PASS’, true); // tell the browser to remove the cookie so the message doesn’t show up every time setcookie(‘wp-postpass_’.COOKIEHASH, NULL, -1, COOKIEPATH); } } in your template: if(defined(‘INVALID_POST_PASS’)) _e(‘The password you entered is … Read more

Set Session Time Limit for Password Protected Posts

The reason is when you execute this code setcookie(‘wp-postpass_’ . COOKIEHASH, ”, 0, COOKIEPATH); It will reset your post password cookie to blank ”, so it just work once To solve this you need to assign the original cookie and extend the timeout, like this setcookie(‘wp-postpass_’ . COOKIEHASH, $_COOKIE[‘wp-postpass_’ . COOKIEHASH], time() + 60 * … Read more

Change Password Hint

Just add a filter, where you can change the text, like this: add_filter( ‘password_hint’, function( $hint ) { return __( ‘MY OWN PASSWORD HINT’ ); } ); This can be added in functions.php in your theme. A bit of an explanation there in core you can see: return apply_filters( ‘password_hint’, $hint ); that is where … Read more

Hide password protected posts

Both the the_content() and the the_excerpt() template tags already account for password-protected posts, via the post_password_required() conditional. If you need to output content, or comments, etc. outside of the_content()/the_excerpt(), call the post_password_required() conditional directly. For example, if you don’t want the comments template to be output if the post is password-protected. you could do the … Read more

Forcing all posts associated with a custom post type to be private

You can hook onto save_post, wp_insert_post or wp_insert_post_data to modify the post object prior to it being inserted or saved. Using save_post or wp_insert_post the callback would need to declare two args and would receive the post object as the second incoming variable.. (and i’m showing you to cover the alternatives, TheDeadMedic’s example would be … Read more

Reset Password – change from name and email address

You can use the following two hooks to change name and email address Use the following in your active theme’s functions.php file. add_filter( ‘wp_mail_from’, ‘wpse_new_mail_from’ ); function wpse_new_mail_from( $old ) { return ‘your email address’; // Edit it with your email address } add_filter(‘wp_mail_from_name’, ‘wpse_new_mail_from_name’); function wpse_new_mail_from_name( $old ) { return ‘your name or your … Read more