OrtusIT New WP-Admin URL
Custom login URL slug for WordPress instead of the default wp-login.php.
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/ortusit/oit-wp-login/archive/refs/heads/main.zipRepository: github.com/ortusit/oit-wp-login — git clone https://github.com/ortusit/oit-wp-login.git
Overview
The plugin lets you set a custom URL slug (in Settings → Permalinks) so visitors no longer use the default wp-login.php address. Requests still go through WordPress's real login script (via rewrite rules or, when permalinks are "plain", optional .htaccess rules), and the plugin adds session checks so the login flow is only allowed when you arrive through your chosen slug—otherwise users are redirected to the site home.
Requirements
| Minimum | |
|---|---|
| WordPress | 5.5 |
| PHP | 7.4 |
| Tested up to | WordPress 6.9.x |
Installation
- Copy the plugin folder to
wp-content/plugins/oit-wp-login-url/(or upload a ZIP via Plugins → Add New → Upload Plugin). - Activate the plugin from the Plugins screen.
- Go to Settings → Permalinks and set New WP-Admin slug (allowed characters:
a-z,0-9,-,_). - Save your permalink settings (save twice if you also changed the permalink structure).
Git
Clone the repository:
git clone https://github.com/ortusit/oit-wp-login.git
cd oit-wp-login
If you are publishing this folder as a new remote (no .git yet), from the project root:
git init
git remote add origin https://github.com/ortusit/oit-wp-login.git
git add README.md oit-wp-login-url.php
git commit -m "Initial commit: OrtusIT New WP-Admin URL v1.4"
git branch -M main
git push -u origin main
If origin already exists: git remote set-url origin https://github.com/ortusit/oit-wp-login.git
License
See LICENSE in this repository (MIT).
What's new in 1.4
Bug fixes
- PHP 8.x —
Undefined array keyon login: parsingREQUEST_URIwhen there is no query string (?) no longer useslist()on a single-elementexplode(); the query string is safely treated as empty. .htaccess: reads viafile_get_contentswith path checks andis_readable, avoidingfile()on a missing file (prevents PHP 8 type issues and warnings).fopen/fwrite: writes after removing markers only if the file opens successfully; the handle is closed properly.get_home_path(): ifstrriposfinds nothing, returnsABSPATHinstead of an invalidsubstrfromfalse.
PHP 8.x compatibility
- Safe access to
$_SERVERkeys (REQUEST_URI,HTTPS,HTTP_HOST,SCRIPT_NAME,QUERY_STRING, etc.). parse_url( home_url() )— validates the result before readingpath.rewrite_baselogic usesexplode( …, 2 )without assuming a missing array index.register_settinguses the array form withsanitize_callback,type, anddefault.- Strict string comparisons (
===/!==) where appropriate;.htaccessmarker lines normalized withrtrimfor\r\n(Windows).
WordPress compatibility (including 6.9.x)
- Plugin headers:
Requires at least,Tested up to,Requires PHP. ABSPATHguard at the top of the main file.- Login redirects use
wp_safe_redirect( home_url( '/' ) )instead of a rawheader( 'Location: …' ). - Settings field and
register_settingrun only on the Permalinks screen or onoptions.phpPOST withoption_page=permalink, so form saves keep working. admin_inithook order: register the setting first, then handle POST.- Slug field output uses
esc_attr();$_POSTvalues go throughwp_unslash().
Other
in_array( …, true )for$pagenowchecks.isset( $GLOBALS['pagenow'] )before use.
Support
Questions and custom work: OrtusIT.
Copyright
© 2026 OrtusIT. All rights reserved.