Forum Replies Created

Viewing 2 replies - 16 through 17 (of 17 total)
  • Thanks for your reply Ipstenu. I keep trying to find ways of avoiding that permissions error page, it has been bothering me for so long, I have just found this bit of code on the forums if anyone is interested – this redirects back to your Site homepage:

    add_action('wp_login','go_home');
    function go_home(){
       wp_redirect( home_url() );
      exit();
    }

    Now you can hover over the my-sites link in the top admin bar and go to your blog. Surely this is better if users decide to login through your main site url.

    Also, I noticed when your on someone elses blog, clicking on the my-sites link directly instead of using the my-sites sub menu to go to your blog, you also go to that permissions error page. After looking in admin-bar.php in wp-includes it has:

    foreach ( (array) $wp_admin_bar->user->blogs as $blog ) {
    		switch_to_blog( $blog->userblog_id );

    This code is inside the my-sites parent rather than outside so that is why that goes to that permissions error page so I worked out a way to rewrite the code in my functions.php to put that code on the outside, I’m no good with php, I tried a few things and somehow I got it to work perfectly.

    I just thought, is there a way to do the same thing by adding the switch_to_blog line and add_action(‘wp_login’,’go_to_blog’); together somehow?

    Forum: Fixing WordPress
    In reply to: using site_url
    Thread Starter andym33

    (@andym33)

    Thanks

Viewing 2 replies - 16 through 17 (of 17 total)