Advertisement
vapvarun

Display user Count with Rest API

Sep 7th, 2018
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.33 KB | None | 0 0
  1. add_shortcode( 'wbc_user_count', 'show_total_users_count');
  2. function show_total_users_count() {
  3.     $response = wp_remote_get( 'https://app.theoneproject.co/wp-json/wp/v2/getusers/' );
  4.     if( !is_wp_error( $response ) ) {
  5.             $users = json_decode( wp_remote_retrieve_body( $response ) );
  6.             return $users;
  7.     }else{
  8.         return false;
  9.     }
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement