Return to Snippet

Revision: 60875
at November 15, 2012 05:25 by adambundy


Initial Code
// add to functions.php

add_filter( 'the_password_form', 'custom_password_form' );
function custom_password_form() {
	global $post;
	$label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID );
	$o = '<form class="protected-post-form" action="' . get_option('siteurl') . '/wp-login.php?action=postpass" method="post">
	' . __( "MESSAGE TO APPEAR ABOVE THE FORM" ) . '
	<label class="pass-label" for="' . $label . '">' . __( "PASSWORD:" ) . ' </label><input name="post_password" id="' . $label . '" type="password" size="30" /><input type="submit" name="Submit" class="button" value="' . esc_attr__( "Submit" ) . '" />
	</form> MESSAGE TO APPEAR BELOW FORM';
	return $o;
}

Initial URL
http://tummel.me/wordpress-3-4-custom-password-form/

Initial Description
Thanks to Tummel.me 

Works on newer (~3.4) versions of WP.

Initial Title
WordPress - change the password request form on password-protected posts and pages

Initial Tags

                                

Initial Language
PHP