Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@yoren
Created January 10, 2014 02:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yoren/8346041 to your computer and use it in GitHub Desktop.
Save yoren/8346041 to your computer and use it in GitHub Desktop.
WordPress: Skip dashboard when log into backend.
<?php
/**
* Skip dashboard when log into backend.
*/
function my_login_redirect( $redirect_to, $url, $user ) {
if ( ! is_wp_error( $user ) && user_can( $user, 'edit_posts' ) ) {
$redirect_to = admin_url( 'edit.php' );
}
return $redirect_to;
}
add_filter( 'login_redirect', 'my_login_redirect', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment