Skip to:
Content
Pages
Categories
Search
Top
Bottom

Admin Login redirects me to site front-end

Viewing 12 replies - 1 through 12 (of 12 total)

  • Stephen Edgar
    Keymaster

    @netweb

    It is most likely a conflict with another plugin, presumably the admin bar plugin.


    Styled Themes
    Participant

    @gejay

    Thanks for the reply… If you are referring to the admin bar plugin for bbPress, that I don’t have, just the default WP user admin bar. I just finished testing all plugins I have installed, and one by one testing the login (each time closing the browser out), but as soon as I activate bbPress, that is when this phenomenon happens…I log into the dashboard and finding myself staring at the site’s front-page. I still have to add a subpage url to the browser address bar, or use the user admin bar at the top to get to the dashboard.

    So, there is something about bbPress that is doing the front page redirect…even if I make bbPress the only active plugin. This does it on my local XAMPP location, as well as my demo site on a live server.

    Incidentally, I’m on the latest WP and bbPress versions.


    Styled Themes
    Participant

    @gejay

    Forgot to mention I also tried the default WP themes…same thing happens.


    Stephen Edgar
    Keymaster

    @netweb

    Are you using WordPress 3.9.1 and bbPress 2.5.4?

    I’m going to need some detailed steps to reproduce the issue as I cannot.

    Are you logging in through the bbPress login widget?

    Are you logging in via http://example.com/wp-login.php and then redirected to your front page?

    What happens if you open http://example.com/wp-admin and login via that URL?
    (After hitting the above URL you should now have a URL similar to:
    http://example.com/wp-login.php?redirect_to=http%3A%2F%2Fexample.com%2Fwp-admin%2F&reauth=1)


    Styled Themes
    Participant

    @gejay

    The latest WP and bbPress versions,yes…actually tried it again with a fresh install of WP, but same issue and with twenty fourteen and thirteen.
    No bbpress login widget, just logging in with the Default WordPress admin login form to get to the dashboard. So correct on the example wp-login.php url you posted. I will use my localhost on XAMPP as an example:

    http://localhost/pref/wp-login.php

    If I use http://localhost/pref/wp-admin I do get logged into the dashboard. The url becomes

    http://localhost/wp39/wp-login.php?redirect_to=http%3A%2F%2Flocalhost%2Fwp39%2Fwp-admin%2F&reauth=1

    when hitting the wp-admin url method.


    Stephen Edgar
    Keymaster

    @netweb

    If I login via http://localhost/wp-login.php I get logged in and returned to the home/front page http://localhost/

    If I login via http://localhost/wp-admin the url becomes http://localhost/wp-login.php?redirect_to=http%3A%2F%2Flocalhost%2Fwp-admin%2F&reauth=1

    If I login via a separate WordPress installed in /pref as a sub directory of the localhost install via http://localhost/pref/wp-admin the login URL becomes http://localhost/pref/wp-login.php?redirect_to=http%3A%2F%2Flocalhost%2Fpref%2Fwp-admin%2F&reauth=1

    Note how the sub folder on my install is also /pref and is also part of the new redirect URL, for whatever reason, most likely a .htaccess issue or some other oddity in your config is is changing the redirect to /wp39.

    With multiple WordPress installs this quite easily happens and you need to make sure you are loading the correct WordPress install you are actually intending to load 😉


    Styled Themes
    Participant

    @gejay

    Sorry my fault about the two different sub directories in the URL’s as I was trying both and guess I pasted them here incorrectly. However, even from one sub directory where I have it installed such as /wp39/ it happens. It also happens on my live server location as well.


    MarcGuay
    Participant

    @marcguay

    Hi. I realize this is an ancient thread but I came across this problem today. domain.com/wp-login.php redirects to the homepage after successful login instead of the admin panel. domain.com/wp-admin redirects to the admin panel because of the automatic addition of the “redirect_to” variable to the URL.

    WP 4.4.2
    bbpress v2.5.8
    Theme: twentyeleven


    MarcGuay
    Participant

    @marcguay

    Here’s a filter that will redirect admins and editors to the admin panel after login.

    add_filter('bbp_redirect_login', 'custom_bbp_redirect_login', 10, 3);
    function custom_bbp_redirect_login($url, $raw_url, $user){
    	if ( !empty($user) && !empty($user->roles) && (in_array( 'administrator', (array)$user->roles ) || in_array( 'editor', (array)$user->roles )) ) {
    		return get_admin_url();
    	} 
    	return $url;
    }

    Thanks for the code !
    Pascal.


    nitinjain490
    Participant

    @nitinjain490

    @MarcGuay Please guide in which php file, we should put the code ?


    Robin W
    Moderator

    @robin-w

Viewing 12 replies - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.
Skip to toolbar