# supportcandy/2.3.1/includes/rest_api/v1/get_agents.php

SupportCandy – AI Customer Support Ticket System &amp; Live Chatbot Agent, version 2.3.1. 29 lines.

- Page: https://pluginprobe.com/plugins/supportcandy/2.3.1/code/includes/rest_api/v1/get_agents.php
- Raw: https://pluginprobe.com/plugins/supportcandy/2.3.1/raw/includes/rest_api/v1/get_agents.php
- Modified: 2022-07-21T08:20:56+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/supportcandy/2.3.1/code/includes/rest_api/v1/get_agents.php#L10-L20`.

```php
<?php
if ( ! defined( 'ABSPATH' ) ) {
  exit; // Exit if accessed directly
}

global $current_user;

$response = array();

$agents = get_terms([
	'taxonomy'   => 'wpsc_agents',
	'hide_empty' => false,
	'meta_query' => array(
    array(
      'key'       => 'agentgroup',
      'value'     => '0',
      'compare'   => '='
    )
  )
]);

$agent_roles = get_option('wpsc_agent_role');

foreach ( $agents as $agent ) :
  
  $response[] = SELF::get_agent_info( $agent->term_id, $agent_roles );

endforeach;

```
