Custom Function (functions.php)
-
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’ );
- The topic ‘Custom Function (functions.php)’ is closed to new replies.