WordPress.org

Ready to get started?Download WordPress

Forums

WP Filter: login_redirect (2 posts)

  1. Cristiano
    Member
    Posted 3 years ago #

    Hi friends,

    I trying to change the default admin page... I mean, when somebody makes a login, by default he is redirected to Dashboard or profile.php... I want to change it.

    I found on the wp-login.php on line 536 (wp version 3.0.1) a filter called login_redirect that I think is the place to touch to change it. But I´m not doing it well.

    The code there is:

    $redirect_to = apply_filters('login_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user);

    I whote it on my functions.php:

    function admin_default_page() {
      $redirect_to = 'http://www.myweb.com.br/wp-admin/post-new.php?post_type=artigo';
    }

    add_filter('login_redirect', 'admin_default_page');

    Any help ???
    Thanks!

  2. Tim Moore
    Moderator
    Posted 3 years ago #

    Try:

    function admin_default_page() {
      return 'http://www.myweb.com.br/wp-admin/post-new.php?post_type=artigo';
    }
    
    add_filter('login_redirect', 'admin_default_page');

Topic Closed

This topic has been closed to new replies.

About this Topic