{"id":1106659,"date":"2016-04-25T08:43:39","date_gmt":"2016-04-25T15:43:39","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/not-fully-compatible-with-wpml-setting-languages-in-directories\/"},"modified":"2016-05-10T09:35:03","modified_gmt":"2016-05-10T16:35:03","slug":"not-fully-compatible-with-wpml-setting-languages-in-directories","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/not-fully-compatible-with-wpml-setting-languages-in-directories\/","title":{"rendered":"Not fully compatible with WPML setting &quot;Languages in directories&quot;"},"content":{"rendered":"<p>The WPML setting &#8220;Language URL format&#8221; has a value called &#8220;Different languages in directories&#8221; that instead of uses the format www.example.com\/?lang=en, uses www.example.com\/en\/<\/p>\n<p>The events calendar does not seem to be fully compatible with this setting. This causes the function call &#8220;get_permalink&#8221; to sometimes return www.example.com\/en\/?lang=en<br \/>\nThis is most notable when editing a custom post type in the backend, where the permalink is clearly visible.<br \/>\nThis issue also appears in search results URLs.<\/p>\n<p>The problem is located in The events calendars Rewrite.php file in the function &#8220;filter_post_type_link&#8221; that is attached to the filter &#8220;post_type_link&#8221;<\/p>\n<p>It happens because the search results page and the backend always uses the &#8220;?lang=&#8221; format (WPML design decision I assume), but this does not mean the the links on these pages should use this format. And therefore the if-statement &#8220;if( empty( $_GET[&#8216;lang&#8217;] ) )&#8221; is not a valid way to determine if a link needs to have the lang attribute.<\/p>\n<p>I can not provide a better solution because I do not understand the purpose of the function since normally WPML should handle this by it self. However if this is related to some events calendar post types, the function should restrict it&#8217;s use to those. Or the check &#8220;if( empty( $_GET[&#8216;lang&#8217;] ) )&#8221; should instead access the WPML &#8220;Language URL format&#8221; option directly.<\/p>\n","protected":false},"template":"","class_list":["post-1106659","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>Not fully compatible with WPML setting &quot;Languages in directories&quot; -<\/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\/not-fully-compatible-with-wpml-setting-languages-in-directories\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Not fully compatible with WPML setting &quot;Languages in directories&quot; -\" \/>\n<meta property=\"og:description\" content=\"The WPML setting &#8220;Language URL format&#8221; has a value called &#8220;Different languages in directories&#8221; that instead of uses the format www.example.com\/?lang=en, uses www.example.com\/en\/ The events calendar does not seem to be fully compatible with this setting. This causes the function call &#8220;get_permalink&#8221; to sometimes return www.example.com\/en\/?lang=en This is most notable when editing a custom post [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/not-fully-compatible-with-wpml-setting-languages-in-directories\/\" \/>\n<meta property=\"article:modified_time\" content=\"2016-05-10T16:35:03+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\/not-fully-compatible-with-wpml-setting-languages-in-directories\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/not-fully-compatible-with-wpml-setting-languages-in-directories\/\",\"name\":\"Not fully compatible with WPML setting &quot;Languages in directories&quot; -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2016-04-25T15:43:39+00:00\",\"dateModified\":\"2016-05-10T16:35:03+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/not-fully-compatible-with-wpml-setting-languages-in-directories\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/not-fully-compatible-with-wpml-setting-languages-in-directories\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/not-fully-compatible-with-wpml-setting-languages-in-directories\/#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\":\"Not fully compatible with WPML setting &quot;Languages in directories&quot;\"}]},{\"@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":"Not fully compatible with WPML setting &quot;Languages in directories&quot; -","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\/not-fully-compatible-with-wpml-setting-languages-in-directories\/","og_locale":"en_US","og_type":"article","og_title":"Not fully compatible with WPML setting &quot;Languages in directories&quot; -","og_description":"The WPML setting &#8220;Language URL format&#8221; has a value called &#8220;Different languages in directories&#8221; that instead of uses the format www.example.com\/?lang=en, uses www.example.com\/en\/ The events calendar does not seem to be fully compatible with this setting. This causes the function call &#8220;get_permalink&#8221; to sometimes return www.example.com\/en\/?lang=en This is most notable when editing a custom post [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/not-fully-compatible-with-wpml-setting-languages-in-directories\/","article_modified_time":"2016-05-10T16:35:03+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\/not-fully-compatible-with-wpml-setting-languages-in-directories\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/not-fully-compatible-with-wpml-setting-languages-in-directories\/","name":"Not fully compatible with WPML setting &quot;Languages in directories&quot; -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2016-04-25T15:43:39+00:00","dateModified":"2016-05-10T16:35:03+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/not-fully-compatible-with-wpml-setting-languages-in-directories\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/not-fully-compatible-with-wpml-setting-languages-in-directories\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/not-fully-compatible-with-wpml-setting-languages-in-directories\/#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":"Not fully compatible with WPML setting &quot;Languages in directories&quot;"}]},{"@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\/1106659","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\/1106659\/revisions"}],"predecessor-version":[{"id":1106667,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1106659\/revisions\/1106667"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1106659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}