Skip to content

Instantly share code, notes, and snippets.

@vladutilie
Created April 28, 2020 07:41
Show Gist options
  • Save vladutilie/4c9d53387971e6ea0a32f3cf2cf6ca80 to your computer and use it in GitHub Desktop.
Save vladutilie/4c9d53387971e6ea0a32f3cf2cf6ca80 to your computer and use it in GitHub Desktop.
Change WordPress password form post
add_filter('the_password_form', 'change_password_form_text' );
function change_password_form_text( $post = 0 ) {
$post = get_post( $post );
$label = 'pwbox-' . ( empty( $post->ID ) ? rand() : $post->ID );
$output = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" class="post-password-form" method="post">
<p>' . __( 'Here is your text:', 'textdomain' ) . '</p>
<p><label for="' . $label . '">' . __( 'Password:' ) . ' <input name="post_password" id="' . $label . '" type="password" size="20" /></label> <input type="submit" name="Submit" value="' . esc_attr_x( 'Enter', 'post password form' ) . '" /></p></form>';
return $output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment