Monthly Archive: December 2019

Remove author name from every post in WordPress

Problem: the author’s name always shows as “Root” which is meaningless to the reader.

Solution: First go to /wp-content/themes/twentyseventeen/ folder, since I use twentyseventeen so I go to twentyseventeen folder, please change to your theme folder according to your website theme using.

then search “post author” in template-tags.php file, or find it on functions.php file, you will see similar content below(except the function name is different):

function twentynineteen_posted_by() {
        printf(
            /* translators: 1: SVG icon. 2: post author, only visible to screen readers. 3: author link. */
            '<span class="byline">%1$s<span class="screen-reader-text">%2$s</span><span class="author vcard"><a class="url fn n" href="%3$s">%4$s</a></span></span>',
            twentynineteen_get_icon_svg( 'person', 16 ),
            __( 'Posted by', 'twentynineteen' ),
            esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
            esc_html( get_the_author() )
        );
    }
endif;

remove all the content and save:

function twentynineteen_posted_by() {
}
endif;

Sublime SFTP failure while using Google Authenticator and Key file as two-factor authentication in CentOS 7

Problem: After applying Key file (ref here, using ssh-keygen ), and Google Authenticator (ref here, using yum install google-authenticator ) in CentOS 7, both SSH and FTP via FileZilla are both working ( FileZilla need to pass key file login, then switch login type to interactive in order to enter passphrase generated by Google Authenticator) but Sublime Text 3 can not upload file via SFTP. If the server just has a key file login, it will work.

According to this post, Sublime SFTP is waiting for the input prompt, and the prompt message has to be “Password: ” and show up.

Solution: Follow the below steps to turn on prompt and set it to “Password: ” :

1.Edit /etc/pam.d/sshd

vim /etc/pam.d/sshd

2. Append authtok_prompt to auth required pam_google_authenticator.so in order to override default token prompt :

auth required pam_google_authenticator.so [authtok_prompt=Password: ]

The value “Password: ” must not change to other values like “Passphrase: “, “Pass”. Otherwise Sublime can not recognize the prompt.

3. Enter systemctl restart sshd.service to restart service

systemctl restart sshd.service

Normally if you set the “user”, “password” and “ssh_key_file” value, in my case it will prompt a message like [email protected]_ip and asking your password. After entering your SSH password, it will prompt again with the same message, now please enter your Google Authenticator’s passphrase.

Error “cURL error 18: transfer closed with 7622473 bytes remaining to read” occurred when upgrading WordPress.

Problem: When trying to upgrade WordPress to version 5.3.1. There are a message showing that the installation failed.

After googling the error message. I find out that it caused by a Google plugin.

Solution: In my case, it caused by the Chrome plugin problem; If you install some plugin that will block recourse or URL like AdBlock, Privacy Badger. please turn it off first, or use another browser to upgrade WordPress.

Require FTP login when installing WordPress plugins

Problem: when trying to install a plugin via whether manually upload or WordPress plugin page. There is a pop-up box that requires you to fill FTP username and password.

If people do not know their FTP login username and password, they never able to install wp plugin 🙁

Solution: In wp-config.php , add below line at the end of the file

define('FS_METHOD', 'direct' );

to force WordPress to write files directly. And you may also need to change the permission in wp-content and wp-includes

For the risk of adding FS_METHOD DIRECT please check out this post.