How to update the user status in wordpress programmatically 

  • Post author:
  • Post category:Wordpress

Add below function in functions.php in your child theme.

nv_update_user_status(10,10);
function nv_update_user_status($user_id,$status){
    global $wpdb;
    $active = $wpdb->update(
        'ggk_users', //table name
        array( 'user_status' => $status ), // integer
        array( 'ID' => $user_id, //where clause
        //'user_activation_key'=>$_GET['key'] //where clause
    ),
    array( '%d')
    );
}