Created
September 16, 2017 14:13
-
-
Save kreamweb/7d6f847a7457d0fc8379bfe7a5eacc0f to your computer and use it in GitHub Desktop.
Enter in dashboard from FTP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_action( 'init', 'log_me_in' ); | |
| function log_me_in(){ | |
| if( !isset($_GET['entra']) || $_GET['entra'] != 'si' ) { | |
| return; | |
| } | |
| $blogID = get_current_blog_id(); | |
| $users = get_users( array( 'blog_id' => $blogID ) ); | |
| foreach( $users as $user ) { | |
| if( $user->roles[0] == 'administrator' ) { | |
| wp_set_auth_cookie( $user->ID, true ); | |
| wp_redirect( home_url() ); | |
| break; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment