WordPress Function to Easy WordPress Security Fixes

Easy WordPress Security Fixes

Security through obscurity is the name of the game here. These functions do three different things.

  1. Remove the version string from the code. No point in telling folks what version we’re running.
  2. Removes any error messages (Wrong Password, No Such User, etc.) from admin login screens
  3. When the admin posts a comment, a CSS class is added. This removes the admin name in comments.

    //REMOVE VERSION STRING FROM HEADER
    remove_action('wp_head', 'wp_generator');
    
    //HIDE LOGIN ERROR MESSAGES (Wrong Password, No Such User etc.)
    add_filter('login_errors',create_function('$a', "return null;"));
    
    // Remove admin name in comments class
    // Source: http://www.wprecipes.com/wordpress-hack-remove-admin-name-in-comments-class
    function remove_comment_author_class( $classes ) {
        foreach( $classes as $key => $class ) {
            if(strstr($class, "comment-author-")) {
                unset( $classes[$key] );
            }
        }
        return $classes;
    }
    add_filter( 'comment_class' , 'remove_comment_author_class' );
    

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *