1

I'm new to WordPress development. I'm using a plugin, "Tribe Events," that stores event venues and organizers associated with an event in the wp_postmeta table and I want to be able to easily access and manipulate the data associated with an event. But apparently, the plugin does not provide a REST API (the tribe_events post type doesn't show with a call to wp-json/wp/v2/types). And from what I can tell, XMLRPC does not allow you to access postmeta data either.

So what are my best options at this point? Use mysql API? Roll my own API for the plugin? These ideas seem a little too ambitious. Alternatively, I guess I can just do what I've been doing which is use WWW::Mechanize::Firefox to automate the creation/deletion/editing of posts (which is kind of crazy).

Any feedback is appreciated.

1 Answer 1

0

You can modify the arguments of the post type to enable the REST API:

function wpd_tribe_events_args( $args, $post_type ) {
    if ( 'tribe_events' == $post_type ) {
        $args['show_in_rest'] = true;
    }
    return $args;
}
add_filter( 'register_post_type_args', 'wpd_tribe_events_args', 20, 2 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.