• Hello,
    I require a login to my site. I am using the Mantra theme. When a user logs in, they are taken to the control panel, but I want them to go to the site home page.
    Any suggestions?

    I found this one (code at bottom), which will work, but it requires editing the functions.php file. It detects user permissions and redirects based on this.

    Can I do this, and will it be overwritten as I upgrade Mantra in the future?

    A better way? or custom function capability?

    https://www.brookfieldbrewers.org/

    <em>
    /**
    * Redirect back to homepage and not allow access to
    * WP admin for Subscribers.
    */
    function themeblvd_redirect_admin(){
    if ( ! current_user_can( ‘edit_posts’ ) ){
    wp_redirect( site_url() );
    exit;
    }
    }
    add_action( ‘admin_init’, ‘themeblvd_redirect_admin’ );

Viewing 1 replies (of 1 total)
  • Thread Starter billyb2084

    (@billyb2084)

    Problem Solved

    I used a Login Redirect plugin, works perfectly.
    I used Peter’s Login Redirect if you’re interested. Works well with the Mantra theme.

Viewing 1 replies (of 1 total)
  • The topic ‘Custom Function (functions.php)’ is closed to new replies.