1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
/**
 * WordPress 更改文章密码保护后显示的提示内容
 * http://www.wpdaxue.com/change-password-protected-text.html
 */
function password_protected_change( $content ) {
    global $post;
    if ( ! empty( $post->post_password ) && stripslashes( $_COOKIE['wp-postpass_'.COOKIEHASH] ) != $post->post_password ) {
        $output = '
 
        
<form action="' . get_option( 'siteurl' ) . '/wp-pass.php" method="post"> '.\_\_( "这是一篇受密码保护的文章,您需要提供访问密码:" ).' <label for="post_password">密码:</label> <input class="input" name="post_password" size="20" type="password"></input><input .="" class="button" name="Submit" type="submit" value="' . __( "></input></form> '; return $output; } else { return $content; } } add\_filter( 'the\_content','password\_protected\_change' );