{"id":1020202,"date":"2015-10-30T06:48:31","date_gmt":"2015-10-30T13:48:31","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-show_in_rest-true-to-the-venues-post-type\/"},"modified":"2015-11-25T06:38:37","modified_gmt":"2015-11-25T14:38:37","slug":"adding-show_in_rest-true-to-the-venues-post-type","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-show_in_rest-true-to-the-venues-post-type\/","title":{"rendered":"Adding show_in_rest = true to the Venues post type"},"content":{"rendered":"<p>Hi,<\/p>\n<p>I am using the WP REST API V2 to create endpoints so that we can access event data for use in a mobile app.  I was successfully able to add show_in_rest = true to the tribe_events and tribe_organizer post types using this function and adding it to my functions.php file.  That gave me access to the post type information.  For some reason if I try using that function for the tribe_venue post type it does not work.  I think it is getting overridden in the plugin for some reason.  For now I made the cardinal sin of adding it to the code in the the-events-calendar\/src\/Tribe\/Main.php file but I would like to know if there is any way that I could use a similar function that won&#8217;t be overridden.  Do you know what my be causing it to not work for venues but to work for events and organizers?<\/p>\n<p>   \/**<br \/>\n  * Add REST API support to an already registered post type.<br \/>\n  *\/<br \/>\n  add_action( &#8216;init&#8217;, &#8216;organizer_rest_support&#8217;, 25 );<br \/>\n  function organizer_rest_support() {<br \/>\n    global $wp_post_types;<\/p>\n<p>    \/\/be sure to set this to the name of your post type!<br \/>\n    $post_type_name = &#8216;tribe_organizer&#8217;;<br \/>\n    if( isset( $wp_post_types[ $post_type_name ] ) ) {<br \/>\n        $wp_post_types[$post_type_name]-&gt;show_in_rest = true;<br \/>\n        $wp_post_types[$post_type_name]-&gt;rest_base = $post_type_name;<br \/>\n        $wp_post_types[$post_type_name]-&gt;rest_controller_class = &#8216;WP_REST_Posts_Controller&#8217;;<br \/>\n    }<br \/>\n  }   <\/p>\n","protected":false},"template":"","class_list":["post-1020202","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Adding show_in_rest = true to the Venues post type -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-show_in_rest-true-to-the-venues-post-type\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Adding show_in_rest = true to the Venues post type -\" \/>\n<meta property=\"og:description\" content=\"Hi, I am using the WP REST API V2 to create endpoints so that we can access event data for use in a mobile app. I was successfully able to add show_in_rest = true to the tribe_events and tribe_organizer post types using this function and adding it to my functions.php file. That gave me access [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-show_in_rest-true-to-the-venues-post-type\/\" \/>\n<meta property=\"article:modified_time\" content=\"2015-11-25T14:38:37+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-show_in_rest-true-to-the-venues-post-type\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-show_in_rest-true-to-the-venues-post-type\/\",\"name\":\"Adding show_in_rest = true to the Venues post type -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2015-10-30T13:48:31+00:00\",\"dateModified\":\"2015-11-25T14:38:37+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-show_in_rest-true-to-the-venues-post-type\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-show_in_rest-true-to-the-venues-post-type\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-show_in_rest-true-to-the-venues-post-type\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Additional Help\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/others\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Translations\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/others\/translation\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Adding show_in_rest = true to the Venues post type\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Adding show_in_rest = true to the Venues post type -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-show_in_rest-true-to-the-venues-post-type\/","og_locale":"en_US","og_type":"article","og_title":"Adding show_in_rest = true to the Venues post type -","og_description":"Hi, I am using the WP REST API V2 to create endpoints so that we can access event data for use in a mobile app. I was successfully able to add show_in_rest = true to the tribe_events and tribe_organizer post types using this function and adding it to my functions.php file. That gave me access [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-show_in_rest-true-to-the-venues-post-type\/","article_modified_time":"2015-11-25T14:38:37+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-show_in_rest-true-to-the-venues-post-type\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-show_in_rest-true-to-the-venues-post-type\/","name":"Adding show_in_rest = true to the Venues post type -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2015-10-30T13:48:31+00:00","dateModified":"2015-11-25T14:38:37+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-show_in_rest-true-to-the-venues-post-type\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-show_in_rest-true-to-the-venues-post-type\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-show_in_rest-true-to-the-venues-post-type\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Additional Help","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/others\/"},{"@type":"ListItem","position":4,"name":"Translations","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/others\/translation\/"},{"@type":"ListItem","position":5,"name":"Adding show_in_rest = true to the Venues post type"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1020202","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1020202\/revisions"}],"predecessor-version":[{"id":1020338,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1020202\/revisions\/1020338"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1020202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}