Tribe__Events__REST__V1__Endpoints__Single_Organizer::insert( int|array $data )
Inserts one or more organizers.
Contents
Parameters
- $data
-
(int|array) (Required) Either an existing linked post ID or the linked post data or an array of the previous options.
Return
(false|array|WP_Error) false if the linked post data is empty, the linked post ID (in an array as requested by the linked posts engine) or a WP_Error if the linked post insertion failed.
Source
File: src/Tribe/REST/V1/Endpoints/Single_Organizer.php
public function insert( $data ) {
$data = (array) $data;
$inserted = array();
foreach ( $data as $entry ) {
$organizer_id = parent::insert( $entry );
if ( $organizer_id instanceof WP_Error ) {
return $organizer_id;
}
$inserted[] = $organizer_id;
}
return array( $this->get_id_index() => wp_list_pluck( $inserted, $this->get_id_index() ) );
}
Changelog
| Version | Description |
|---|---|
| bucket/full-rest-api | Introduced. |