Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A little one file WordPress plugin that will disable the authors single template (don't enable this plugin it if you use the author's template) and redirect bots that try to connect with the ''admin" username to my favorite NSFW website. Cheers!
Plugin Name: Go F Yourself
Description: Disable '?author=n' view and redirect people trying to login with the "admin" user
Version: 1.0
Author: Benjamin Niess
Author URI:
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
class Go_Fuck_Yourself {
function __construct() {
add_action( 'wp_authenticate', array( __CLASS__, 'fuck_admin_login' ) );
add_action( 'template_redirect', array( __CLASS__, 'disable_author_page' ), 1 );
* If someone tries to login with the username 'admin' => redirect to my favourite website
public static function fuck_admin_login( $login = '' ) {
if ( 'admin' != $login ) {
return false;
wp_redirect( '' ); // This is an example.
* If someone tries to reach a page like homepage/?author=1 to get the name of the first user => redirect to the HP
public static function disable_author_page() {
if ( ! is_author() ) {
return false;
wp_redirect( home_url( '/' ) );
// Init the plugin
function gfy_init() {
new Go_Fuck_Yourself();
add_action( 'plugins_loaded', 'gfy_init' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.