• Resolved gjhdigital

    (@gjhdigital)


    Hello, I added a custom field to add in my Event called “entertainer”, it should be returning a selected “user_id” value. I see the drop down when creating the Event, but I dont see in in the “wp-json/tribe/events/v1/events” after I added it in the add_filter method.
    Any help would be appreciated.

    add_filter( ‘tribe_rest_single_event_data’, ‘entertainer’ );
    function entertainer( array $event_data ) {
    $event_id = $event_data[‘id’];
    $level = get_post_meta( $event_id, ”, true );
    $event_data[‘entertainer’] = $level;
    return $event_data;
    }

    JSON response from my “wp-json/tribe/events/v1/events endpoint”

    {“events”:[{“id”:92,”global_id”:”mweb.site?id=92″,”global_id_lineage”:[“mweb.site?id=92″],”author”:”2″,”status”:”publish”,”date”:”2023-01-18 18:43:06″,”date_utc”:”2023-01-18 18:43:06″,”modified”:”2023-01-18 19:02:13″,”modified_utc”:”2023-01-18 19:02:13″,”url”:”https:\/\/mweb.site\/event\/greg-test-event\/”,”rest_url”:”https:\/\/mweb.site\/wp-json\/tribe\/events\/v1\/events\/92″,”title”:”Greg test event”,”description”:”
    the event description<\/p>”,”excerpt”:””,”slug”:”greg-test-event”,”image”:false,”all_day”:false,”start_date”:”2023-02-18 08:00:00″,”start_date_details”:{“year”:”2023″,”month”:”02″,”day”:”18″,”hour”:”08″,”minutes”:”00″,”seconds”:”00″},”end_date”:”2023-02-18 17:00:00″,”end_date_details”:{“year”:”2023″,”month”:”02″,”day”:”18″,”hour”:”17″,”minutes”:”00″,”seconds”:”00″},”utc_start_date”:”2023-02-18 08:00:00″,”utc_start_date_details”:{“year”:”2023″,”month”:”02″,”day”:”18″,”hour”:”08″,”minutes”:”00″,”seconds”:”00″},”utc_end_date”:”2023-02-18 17:00:00″,”utc_end_date_details”:{“year”:”2023″,”month”:”02″,”day”:”18″,”hour”:”17″,”minutes”:”00″,”seconds”:”00″},”timezone”:”UTC+0″,”timezone_abbr”:”UTC+0″,”cost”:””,”cost_details”:{“currency_symbol”:””,”currency_code”:””,”currency_position”:”prefix”,”values”:[]},”website”:””,”show_map”:false,”show_map_link”:false,”hide_from_listings”:false,”sticky”:false,”featured”:false,”categories”:[],”tags”:[],”venue”:{“id”:95,”author”:”2″,”status”:”publish”,”date”:”2023-01-18 18:41:27″,”date_utc”:”2023-01-18 18:41:27″,”modified”:”2023-01-18 18:41:27″,”modified_utc”:”2023-01-18 18:41:27″,”url”:”https:\/\/mweb.site\/venue\/gregs-bar-and-grill\/”,”venue”:”Gregs Bar and Grill”,”description”:”
    A cool place to play<\/p>”,”slug”:”gregs-bar-and-grill”,”address”:”1 Main St”,”city”:”Bethel”,”country”:”United States”,”state”:”CT”,”zip”:”06810″,”phone”:”12031112222″,”stateprovince”:”CT”,”show_map”:true,”show_map_link”:true,”global_id”:”mweb.site?id=95″,”global_id_lineage”:[“mweb.site?id=95″]},”organizer”:[]}],”rest_url”:”https:\/\/mweb.site\/wp-json\/tribe\/events\/v1\/events\/?page=1&per_page=50&start_date=2023-01-17 00:00:00&end_date=2025-01-18 23:59:59&status=publish”,”total”:1,”total_pages”:1}

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom field not showing in Events rest api’ is closed to new replies.