{"id":1170069,"date":"2016-09-28T14:53:56","date_gmt":"2016-09-28T21:53:56","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/removing-event-from-single-event-slug\/"},"modified":"2016-09-28T14:57:23","modified_gmt":"2016-09-28T21:57:23","slug":"removing-event-from-single-event-slug","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/removing-event-from-single-event-slug\/","title":{"rendered":"Removing \/event\/ from single event slug"},"content":{"rendered":"<p>Hi there,<\/p>\n<p>After searching the forum for ideas on how to remove the \/event\/ slug from the single event only, I found this code: <\/p>\n<pre><code>\/**\n * Remove the slug from published post permalinks. Only affect our custom post type, though.\n *\/\nfunction gp_remove_cpt_slug( $post_link, $post, $leavename ) {\n \n    if ( &#039;tribe_events&#039; != $post-&gt;post_type || &#039;publish&#039; != $post-&gt;post_status ) {\n        return $post_link;\n    }\n \n    $post_link = str_replace( &#039;\/event\/&#039;, &#039;\/&#039;, $post_link );\n \n    return $post_link;\n}\nadd_filter( &#039;post_type_link&#039;, &#039;gp_remove_cpt_slug&#039;, 10, 3 );\n\/**\n * Some hackery to have WordPress match postname to any of our public post types\n * All of our public post types can have \/post-name\/ as the slug, so they better be unique across all posts\n * Typically core only accounts for posts and pages where the slug is \/post-name\/\n *\/\nfunction custom_parse_request_tricksy( $query ) {\n\n    \/\/ Only noop the main query\n    if ( ! $query-&gt;is_main_query() )\n        return;\n\n    \/\/ Only noop our very specific rewrite rule match\n    if ( 2 != count( $query-&gt;query ) || ! isset( $query-&gt;query[&#039;page&#039;] ) ) {\n        return;\n    }\n\n    \/\/ &#039;name&#039; will be set if post permalinks are just post_name, otherwise the page rule will match\n    if ( ! empty( $query-&gt;query[&#039;name&#039;] ) ) {\n        $query-&gt;set( &#039;post_type&#039;, array( &#039;post&#039;, &#039;tribe_events&#039;, &#039;page&#039; ) );\n    }\n}\nadd_action( &#039;pre_get_posts&#039;, &#039;custom_parse_request_tricksy&#039; );<\/code><\/pre>\n<p>However, something breaks along the way&#8230;the content area of the events show up, but the export to calendar buttons, as well as the primary meta and the secondary meta areas, won&#8217;t display. It&#8217;s almost as if a whole other page was setup, especially weird, because I can access the event in its entirety by going to \/event\/permalink, but \/permalink is only &#8220;half loaded&#8221; (if that makes sense).<\/p>\n<p>I know this is probably outside of the scope of the Pro support, but if you could guide me to some clues as to what is causing this, I&#8217;d very much appreciate it. Is it the pre_get_posts call that is somehow interfering? That&#8217;s one I&#8217;m not great with, so that could certainly be it.<\/p>\n<p>Thanks in advance<\/p>\n","protected":false},"template":"","class_list":["post-1170069","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>Removing \/event\/ from single event slug -<\/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\/removing-event-from-single-event-slug\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Removing \/event\/ from single event slug -\" \/>\n<meta property=\"og:description\" content=\"Hi there, After searching the forum for ideas on how to remove the \/event\/ slug from the single event only, I found this code: \/** * Remove the slug from published post permalinks. Only affect our custom post type, though. *\/ function gp_remove_cpt_slug( $post_link, $post, $leavename ) { if ( &#039;tribe_events&#039; != $post-&gt;post_type || &#039;publish&#039; [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/removing-event-from-single-event-slug\/\" \/>\n<meta property=\"article:modified_time\" content=\"2016-09-28T21:57:23+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=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/removing-event-from-single-event-slug\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/removing-event-from-single-event-slug\/\",\"name\":\"Removing \/event\/ from single event slug -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2016-09-28T21:53:56+00:00\",\"dateModified\":\"2016-09-28T21:57:23+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/removing-event-from-single-event-slug\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/removing-event-from-single-event-slug\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/removing-event-from-single-event-slug\/#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\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Events Calendar PRO\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Removing \/event\/ from single event slug\"}]},{\"@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":"Removing \/event\/ from single event slug -","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\/removing-event-from-single-event-slug\/","og_locale":"en_US","og_type":"article","og_title":"Removing \/event\/ from single event slug -","og_description":"Hi there, After searching the forum for ideas on how to remove the \/event\/ slug from the single event only, I found this code: \/** * Remove the slug from published post permalinks. Only affect our custom post type, though. *\/ function gp_remove_cpt_slug( $post_link, $post, $leavename ) { if ( &#039;tribe_events&#039; != $post-&gt;post_type || &#039;publish&#039; [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/removing-event-from-single-event-slug\/","article_modified_time":"2016-09-28T21:57:23+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/removing-event-from-single-event-slug\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/removing-event-from-single-event-slug\/","name":"Removing \/event\/ from single event slug -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2016-09-28T21:53:56+00:00","dateModified":"2016-09-28T21:57:23+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/removing-event-from-single-event-slug\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/removing-event-from-single-event-slug\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/removing-event-from-single-event-slug\/#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":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Events Calendar PRO","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/"},{"@type":"ListItem","position":5,"name":"Removing \/event\/ from single event slug"}]},{"@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\/1170069","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":0,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1170069\/revisions"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1170069"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}