Skip to content

Instantly share code, notes, and snippets.

@yoren

yoren/functions.php

Created Jan 10, 2014
Embed
What would you like to do?
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