title: Save User Categories in WordPress
body: <p>I've been following along with the following tutorial <a href="https://www.nopio.com/blog/add-user-taxonomy-wordpress/" rel="nofollow noreferrer">How to Add User Taxonomy in WordPress
  </a>, my issue is that the user categories do not save.  I want to be able to add categories to the users for filtering capabilities.</p>
  <p>Here is my function for saving:</p>
  <pre><code>add_action( 'personal_options_update', 'ru_admin_save_user_categories' );
  add_action( 'edit_user_profile_update', 'ru_admin_save_user_categories' );
  
  
  function ru_admin_save_user_categories( $user_id ) {
      $tax = get_taxonomy( USER_CATEGORY_NAME );
      $user = get_userdata( $user_id );
  
  if ( !user_can( $user, 'administrator' ) ) {
      return false;
  }
  
  $new_categories_ids = $_POST[USER_CATEGORY_META_KEY];
  $user_meta = get_user_meta( $user_id, USER_CATEGORY_META_KEY, true );
  $previous_categories_ids = array();
  
  if( !empty( $user_meta ) ) {
      $previous_categories_ids = (array)$user_meta;
  }
  
  if( ( current_user_can( 'administrator' ) &amp;&amp; $_POST['role'] != 'author' ) ) {
      delete_user_meta( $user_id, USER_CATEGORY_META_KEY );
      ru_update_users_categories_count( $previous_categories_ids, array() );
  } else {
      update_user_meta( $user_id, USER_CATEGORY_META_KEY, $new_categories_ids );
      ru_update_users_categories_count( $previous_categories_ids, $new_categories_ids );
  }
  }
  </code></pre>
  <p>Upon submitting nothing happens and I do not see the data saved in user meta either.</p>