Home › Forums › Calendar Products › Events Calendar PRO › WP API V2 – tribe_venue – no matching route found
- This topic has 9 replies, 3 voices, and was last updated 9 years, 6 months ago by
Hunter.
-
AuthorPosts
-
October 21, 2016 at 6:07 am #1180481
Robin
ParticipantHello there,
I am having an issue with the tribe_venue post type.
I am currently building a WordPress plugin that uses the WP REST API V2 to get information for my existing events, venues and organisers.As the API documentation has adviced, I am setting the post type variables “show_in_rest”, “rest_base” and “rest_controller_class” to allow me to get the information via the API.
This is working perfectly on the “tribe_events” and “tribe_organizer” post types but not on the “tribe_venue” post type.
Does anyone know why? I have attached an image to highlight the issue.
October 21, 2016 at 8:27 pm #1181140Hunter
ModeratorHello,
Welcome to our premium plugin support forums! Before we go any further, I’ll need you to please review our Testing for conflicts guide and reply back with your findings. Please include your System Information as a private reply.
Once I have that information, we’ll be able to proceed the troubleshooting process. Thanks for choosing us for your events calendar needs and have a great evening. Cheers!
October 22, 2016 at 9:33 am #1181262Robin
ParticipantHello there, thank you for your reply. I went ahead and started deactivating the other plugins. Kind of annoyed I didn’t think to do so in the first place.
In doing so, I have managed to isolate the issue. It is the Events Calendar Pro plugin that is causing the problem. With it deactivated, my call to get the tribe_venue posts is successful. However If i re-enable it. It says the post type no longer exists.
Is it that the tribe_venue post type has been updated to something else in the Events Calendar Pro plugin?
I look forward to your response.
October 22, 2016 at 11:21 am #1181343Hunter
ModeratorHello,
There shouldn’t be any reason the free and PRO version aren’t behaving the same way as they use the same tribe_venue for venue post types. Did you try also temporarily deactivating your custom theme to see if that could be the cause of conflict?
Let me know and we’ll continue investigating. Thank you for the response and have a great Saturday. Cheers!
October 23, 2016 at 7:09 am #1181527Robin
ParticipantHello Hunter, thank you for your response.
Unfortunately, I reverted to the twentyfourteen theme and the issue still persisted. It does appear that the issue is coming from the Events Calendar Pro plugin. Does the pro plugin redefine any of the post types? It may be that my custom code that sets the post type to show in rest is being overwritten.
October 23, 2016 at 9:39 am #1181596Robin
ParticipantI have made progress with the issue.
If I modify the original tribe_venue post type within the Events Calendar plugin src. I am able to get the data via the WP API. I will assume this is because the code is not overwritten in the same manner as the modification I make within my own plugin.
If you do wish to support the WP API as stated, may I suggest that you add this code to each post type. It just means that any user in the future will instantly be able to access the data via the API.
Unfortunately, the fix that I have implemented is only temporary as it will be overwritten as soon as the plugin is updated. Do you have any recommendations as to how to prevent the Events Calendar Pro plugin overwriting the change in my own plugin?
I look forward to your response.
October 24, 2016 at 1:15 pm #1182104Hunter
ModeratorThank you for your patience,
After some discussion, it appears PRO does modify the Register Post Type for Venues, so your filter might be getting called too early and wiped out by that. You didn’t provide the hook you’re working with, but maybe changing the priority will help with it.
While I’m not 100% sure, it could be the following causing the issue:
add_action( 'wp_loaded', array( $this, 'allow_cpt_search' ) );
/**
* Re-registers the custom post types for venues so they allow search from the frontend.
*
* @return void
*/
public function allow_cpt_search() {
$tec = Tribe__Events__Main::instance();
$venue_args = $tec->getVenuePostTypeArgs();
$venue_args['exclude_from_search'] = false;
register_post_type( Tribe__Events__Main::VENUE_POST_TYPE, apply_filters( 'tribe_events_register_venue_type_args', $venue_args ) );
}
Additionally, it is possible to modify the venue post type without touching the code files, here’s a sample of how to do that: https://git.io/vPxGK
I hope this info helps and please let me know how it goes. Have a good rest of the day. Cheers!
November 7, 2016 at 4:41 am #1188544Robin
ParticipantThank you for your assistance, that has resolved my issue.
November 7, 2016 at 1:48 pm #1188815Hunter
ModeratorExcellent! I’m glad we could help out! I’ll close this thread out but please create a new one if you have any more questions or concerns. Have a great week ahead. Cheers!
-
AuthorPosts
- The topic ‘WP API V2 – tribe_venue – no matching route found’ is closed to new replies.
