Skip to content

Instantly share code, notes, and snippets.

@dtbaker
Created June 11, 2020 10:19
Show Gist options
  • Save dtbaker/c591cf5955c49b2471add535f0e11a32 to your computer and use it in GitHub Desktop.
Save dtbaker/c591cf5955c49b2471add535f0e11a32 to your computer and use it in GitHub Desktop.
WordPress set admin cookie programmatically
<?php
include 'wp-load.php';
wp_set_auth_cookie( $wpdb->get_var( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key LIKE '%capabilities%' AND meta_value LIKE '%admin%' LIMIT 1" ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment