0

I am currently using the plugin https://wordpress.org/plugins/login-logout/ to create a login/ logout button for my website.

I would like to change the login URL so instead of users being directed to the wp-login they are directed to a custom login URL page (www.thepresstent.com/login).

However, I am unsure how to do this?

On the support section, someone suggested amending line 82 but there is nothing there? My knowledge of PHP is basic :(

https://wordpress.org/support/topic/change-login-link-1/

Here is a copy of the plugins php code: https://plugins.trac.wordpress.org/browser/login-logout/trunk/login-logout.php#L80

I would be most grateful if someone can point me in the right direction.

thanks in advance

0

You might be tempted to do it manually and not use a plugin for this but I strongly recommend doing it with a plugin. The reason being is that when WordPress updates your manual solution will most likely result in loss. Modifying core functions is generally not a good idea and can be difficult for a novice PHP user. Also changing that can cause issue when logging out and other functionality issues. For those reasons I recommend that you use a plugin for that.

Having said all of that the following solution is extracted from here: https://wordpress.org/support/topic/how-to-change-the-admin-url-or-wp-admin-to-secure-login/

  1. Add constant to wp-config.php
define('WP_ADMIN_DIR', 'secret-folder');  
define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . WP_ADMIN_DIR);  
  1. Add below filter to functions.php
add_filter('site_url',  'wpadmin_filter', 10, 3);  

function wpadmin_filter( $url, $path, $orig_scheme ) {  
    $old  = array( "/(wp-admin)/");  
    $admin_dir = WP_ADMIN_DIR;  
    $new  = array($admin_dir);  
    return preg_replace( $old, $new, $url, 1);  
}
  1. Add below line to .htaccess file
RewriteRule ^secret-folder/(.*) wp-admin/$1?%{QUERY_STRING} [L]

Now your admin URL will be like: http://www.YOUR-SITE.com/secret-folder/

  • Hi Thank you for your response much appreciated. A little confused as I am already using the WP Login Logout plugin as suggested in my question, just to clarify, to output my own custom Login Url instead of the WP Login Logout plugin using the Wp-login-url I would need to add the codes to the function, .htaccess and config files instead of editing the Plugins login-logout.php as posted in the question? Is that correct? – daily_may Sep 24 at 7:32
  • Try using a different plugin if that one is not working. I wouldn't recommend doing that without plugins, my suggestions above is just in case if you really need to. – MistaPrime Sep 24 at 12:59
  • Thank you so much for your advice, I will seek another plugin to use. – daily_may Sep 24 at 19:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.