title: How to get JSON id after item is created
body: <p>Im using a function to share a collection of bookmarks with other users and i need to get the id after the new item is created in wordpress userpro bookmarks plugin</p>
  
  <pre><code>function share_collection($id,$name,$cbcolor,$user) {
      $user_id = get_user_by( 'email', $user );
      $user_id_current = get_current_user_id();
      $collectionscurrent = $this-&gt;get_collections($user_id_current);
      $collections = $this-&gt;get_collections($user_id-&gt;ID);
      $collections[] = array('label' =&gt; $name);
  
      // transfer bookmarks to shared collection
      foreach($collectionscurrent[$coll_id] as $k =&gt; $arr) {
          if ($k != 'label') {
              $collections["This is where id should go"][$k] = 1;
          }
      }
  
      update_user_meta($user_id-&gt;ID, '_wpb_collections', $collections);
  }
  </code></pre>
  
  <p>How do i retrive the id created from $collections[] = array('label' => $name); and use it in the place where i mentioned "This is where id should go"</p>
  
  <p>get_collections function is as follows</p>
  
  <pre><code>function get_collections($user_id) {
      return (array)get_user_meta($user_id, '_wpb_collections', true);
  }
  </code></pre>
  
  <p>Thanks in advance!</p>