Disable wp-admin redirect in Ghost

Ghost by default has redirect settings, so WordPress users who have migrated to Ghost, can visit the same old <code class="highlighter-rouge">/wp-admin url and get redirected to the <code class="highlighter-rouge">/ghost url, to access the Ghost Admin.

This is a useful functionality for users who have migrated to Ghost, who didn’t have knowledge that Ghost uses <code class="highlighter-rouge">/ghost instead of <code class="highlighter-rouge">/wp-admin.

Some user would like to disable this feature, due to various reasons.

This can be done by editing the /core/server/routes/frontend.js file and changing the following lines.


router.get(/^/((ghost-admin|admin|wp-admin|dashboard|signin|login)/?)$/, function (req, res) {  
        /*jslint unparam:true*/
        res.redirect(subdir + '/ghost/');

Remove <code class="highlighter-rouge">wp-admin, the changes should look like:

router.get(/^/((ghost-admin|admin|dashboard|signin|login)/?)$/, function (req, res) {  
        /*jslint unparam:true*/
        res.redirect(subdir + '/ghost/');

Save the file.

Now restart Ghost, now Ghost will not redirect when you visit <code class="highlighter-rouge">wp-admin, it will instead display <code class="highlighter-rouge">404 page.

Happy Blogging.

Have a question? leave a comment below.

Published by Darryl

A visual effects artist and compositor, self learner, Linux enthusiast and Programmer and can write in Python and Rust. Contributor to open source projects.

Leave a comment

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