namespace, '/' . $this->base, [ [ 'methods' => WP_REST_Server::READABLE, 'callback' => [ $this, 'get_items' ], // 'permission_callback' => [ $this, 'get_items_permissions_check' ], // 'args' => $this->get_collection_params(), ], ] ); } /** * Get List Of Taxonomies * * Based on request to get collection * * @return WP_REST_Response is json data */ public function get_items( $request ) { $opalestate_terms = [ 'property_category', 'opalestate_amenities', 'opalestate_label', 'opalestate_status', 'opalestate_types', 'opalestate_location', 'opalestate_city', 'opalestate_state', ]; $all_terms = []; foreach ( $opalestate_terms as $term_name ) { $all_terms[ $term_name ] = get_terms( apply_filters( 'opalestate_all_terms_api_args', [ 'taxonomy' => $term_name, 'hide_empty' => false, ] ) ); } if ( ! $all_terms ) { return $this->get_response( 404, [ 'collection' => [], 'message' => esc_html__( 'Not found!', 'opalestate-pro' ) ] ); } $response['collection'] = $all_terms; return $this->get_response( 200, $response ); } }