Skip to content

Instantly share code, notes, and snippets.

@nckltcha
Created February 16, 2015 14:47
Show Gist options
  • Select an option

  • Save nckltcha/4775d2b41e40b3fb5121 to your computer and use it in GitHub Desktop.

Select an option

Save nckltcha/4775d2b41e40b3fb5121 to your computer and use it in GitHub Desktop.
<?php
function my_password_form() {
global $post;
$label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID );
$o = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" method="post">
' . __( "To view this protected post, enter the password below:" ) . '
<label for="' . $label . '">' . __( "Password:" ) . ' </label><input name="post_password" id="' . $label . '" type="password" size="20" maxlength="20" /><input type="submit" name="Submit" value="' . esc_attr__( "Submit" ) . '" />
</form>
';
return $o;
}
add_filter( 'the_password_form', 'my_password_form' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment