Title: Create an event post with PHP
Last modified: October 25, 2019

---

# Create an event post with PHP

 *  Resolved [sicariusalex](https://wordpress.org/support/users/sicariusalex/)
 * (@sicariusalex)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/create-an-event-post-with-php/)
 * I am creating an event as such:
 *  $newEvent = array(
    ‘post_type’ => ‘event_listing’, ‘post_title’ =>$title, ‘
   post_status’ => ‘publish’, ‘meta_input’=> array( ‘_event_title’ =>$title, ‘_event_category’
   => $categories, ‘_event_start_date’ => $startDate, ‘_event_end_date’ => $endDate,‘
   _event_banner’ => $image, ‘_links_to’ => $url, ‘_event_location’ => $venue )
 * I am struggling to set the event category. How do I do so?

Viewing 1 replies (of 1 total)

 *  [Hitesh Makvana](https://wordpress.org/support/users/hiteshmakvana/)
 * (@hiteshmakvana)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/create-an-event-post-with-php/#post-12067906)
 * Hi [@sicariusalex](https://wordpress.org/support/users/sicariusalex/),
 * The event category is not custom meta it is taxonomy. Please refer this link 
   [https://developer.wordpress.org/reference/functions/wp_insert_post/](https://developer.wordpress.org/reference/functions/wp_insert_post/)
 * You can connect taxonomy by following this [https://developer.wordpress.org/reference/functions/wp_set_object_terms/](https://developer.wordpress.org/reference/functions/wp_set_object_terms/)
 * Thank you

Viewing 1 replies (of 1 total)

The topic ‘Create an event post with PHP’ is closed to new replies.

 * ![](https://ps.w.org/wp-event-manager/assets/icon-256x256.png?rev=1622826)
 * [WP Event Manager – Events Calendar, Registrations, Sell Tickets with WooCommerce](https://wordpress.org/plugins/wp-event-manager/)
 * [Support Threads](https://wordpress.org/support/plugin/wp-event-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-event-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-event-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-event-manager/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Hitesh Makvana](https://wordpress.org/support/users/hiteshmakvana/)
 * Last activity: [6 years, 6 months ago](https://wordpress.org/support/topic/create-an-event-post-with-php/#post-12067906)
 * Status: resolved