Title: Custom Function (functions.php)
Last modified: August 21, 2016

---

# Custom Function (functions.php)

 *  [billyb2084](https://wordpress.org/support/users/billyb2084/)
 * (@billyb2084)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/custom-function-functionsphp/)
 * 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?
 * [http://www.brookfieldbrewers.org/](http://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](https://wordpress.org/support/users/billyb2084/)
 * (@billyb2084)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/custom-function-functionsphp/#post-4761159)
 * 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.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/mantra/3.3.4/screenshot.png)
 * Mantra
 * [Support Threads](https://wordpress.org/support/theme/mantra/)
 * [Active Topics](https://wordpress.org/support/theme/mantra/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/mantra/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/mantra/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [billyb2084](https://wordpress.org/support/users/billyb2084/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/custom-function-functionsphp/#post-4761159)
 * Status: not resolved