Wordpress - Custom Password Form


/ Published in: PHP
Save to your folder(s)

WP Functions


Copy this code and paste it in your HTML
  1. /* CUSTOM PASSWORD FORM */
  2. add_filter( 'the_password_form', 'custom_password_form' );
  3. function custom_password_form() {
  4. global $post;
  5. $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID );
  6. $o = '<form class="protected-post-form" action="' . get_option('siteurl') . '/wp-pass.php" method="post">
  7. ' . __( "CUSTOM MESAGE TO CUSTOMERS HERE" ) . '
  8. <label for="' . $label . '">' . __( "Password:" ) . ' </label><input name="post_password" id="' . $label . '" type="password" size="20" /><input type="submit" name="Submit" value="' . esc_attr__( "Submit" ) . '" />
  9. </form>
  10. ';
  11. return $o;
  12. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.