Last active
June 27, 2022 08:55
-
-
Save webaware/11387141 to your computer and use it in GitHub Desktop.
Remove the register link from the WordPress wp-login.php script. See blog post: http://snippets.webaware.com.au/snippets/remove-register-link-wordpress-wp-login-php/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Register Link Remover | |
Plugin URI: https://gist.github.com/webaware/11387141 | |
Description: remove the register link from the wp-login.php script | |
Version: 1 | |
Author: WebAware | |
Author URI: http://www.webaware.com.au/ | |
*/ | |
/* | |
copyright (c) 2014 WebAware Pty Ltd (email : rmckay@webaware.com.au) | |
This program is free software; you can redistribute it and/or modify | |
it under the terms of the GNU General Public License, version 2, as | |
published by the Free Software Foundation. | |
This program is distributed in the hope that it will be useful, | |
but WITHOUT ANY WARRANTY; without even the implied warranty of | |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
*/ | |
/** | |
* remove the register link from the wp-login.php script | |
*/ | |
add_filter('option_users_can_register', function($value) { | |
$script = basename(parse_url($_SERVER['SCRIPT_NAME'], PHP_URL_PATH)); | |
if ($script == 'wp-login.php') { | |
$value = false; | |
} | |
return $value; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Did not work for me. Thanks for code. Any idea what filter to add to my child theme functions file if we rename the login page? For security we rename the login from usual one to some text (using WP Simple Firewall plugin).
thank you