{"id":6741825,"date":"2015-11-12T10:59:42","date_gmt":"2015-11-12T10:59:42","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/wpml-support-43\/"},"modified":"2016-08-30T20:11:32","modified_gmt":"2016-08-30T20:11:32","slug":"wpml-support-43","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/wpml-support-43\/","title":{"rendered":"WPML support"},"content":{"rendered":"<p>For WPML support, filters need to be applied on the query that gets the results (as is done in wp_get_archives()). I found the following to be working:<\/p>\n<pre><code>\/**\n * Filter the SQL WHERE clause for retrieving archives.\n *\/\n$where = apply_filters( &#039;getarchives_where&#039;, &quot;WHERE post_type = &#039;post&#039; AND post_status = &#039;publish&#039;&quot; );\n\n\/**\n * Filter the SQL JOIN clause for retrieving archives.\n *\/\n$join = apply_filters( &#039;getarchives_join&#039;, &#039;&#039; );\n\n\/\/the following is the query from widget-archives.php:59 with added $jon and $where\nif ( $months = $wpdb-&gt;get_results( &quot;SELECT YEAR(post_date) AS &lt;code&gt;year&lt;\/code&gt;, MONTH(post_date) AS &lt;code&gt;num_month&lt;\/code&gt;, DATE_FORMAT(post_date, &#039;%M&#039;) AS &lt;code&gt;month&lt;\/code&gt;, count(ID) as &lt;code&gt;post_count&lt;\/code&gt; FROM $wpdb-&gt;posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date&quot; ) ) {\n\n\/\/ rest of the code follows<\/code><\/pre>\n<p>https:\/\/wordpress.org\/plugins\/better-archives-widget\/<\/p>\n","protected":false},"template":"","class_list":["post-6741825","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/6741825","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/6741825\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=6741825"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}