{"id":75,"date":"2012-01-23T21:49:36","date_gmt":"2012-01-23T21:49:36","guid":{"rendered":"http:\/\/www.btb4net.com\/borenblog\/?p=75"},"modified":"2013-02-13T08:48:33","modified_gmt":"2013-02-13T08:48:33","slug":"remove-custom-filters-in-page-with-multiple-query_posts","status":"publish","type":"post","link":"https:\/\/www.btb4net.com\/borenblog\/remove-custom-filters-in-page-with-multiple-query_posts\/","title":{"rendered":"Remove custom filters  in page with multiple query_posts"},"content":{"rendered":"<p>There&nbsp;are&nbsp;situations where one page contains&nbsp;multiple post queries(function <a href=\"http:\/\/codex.wordpress.org\/Function_Reference\/query_posts\" target=\"_blank\">query_posts<\/a>) for different conditions(parent categories, tags, etc.), and some of&nbsp;post queries&nbsp;have custom filters(added by <a href=\"http:\/\/codex.wordpress.org\/Function_Reference\/add_filter\" target=\"_blank\">add_filter<\/a> function). Next&nbsp;<a href=\"http:\/\/codex.wordpress.org\/Function_Reference\/query_posts\" target=\"_blank\">query_posts<\/a>&nbsp;call will keep this custom filters, and that could make totaly unespected posts results. Before execute next&nbsp;post query,&nbsp;please add this&nbsp;kind of&nbsp;code&nbsp;to remove previous custom filter, i.e.:<\/p>\n<p><code>if (has_filter(&#39;posts_where&#39;, &#39;filter_date_range_future&#39;)) remove_filter( &#39;posts_where&#39;, &#39;filter_date_range_future&#39;);<\/code><\/p>\n<p>&nbsp;<em>&#39;filter_date_range_future&#39; <\/em>is example function:<\/p>\n<p><code>function filter_date_range_future($where = &#39;&#39;) { <br \/>\n\t&nbsp; $where .= &quot; AND post_date &gt;= &#39;&quot; . date(&#39;Y-m-d&#39;) . &quot;&#39;&quot;; <br \/>\n\t&nbsp; return $where;<br \/>\n\t}<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>There&nbsp;are&nbsp;situations where one page contains&nbsp;multiple post queries(function query_posts) for different conditions(parent categories, tags, etc.), and some of&nbsp;post queries&nbsp;have custom filters(added by add_filter function). Next&nbsp;query_posts&nbsp;call will keep this custom filters, and that could make totaly unespected posts results. Before execute next&nbsp;post query,&nbsp;please add this&nbsp;kind of&nbsp;code&nbsp;to remove previous custom filter, i.e.: if (has_filter(&#39;posts_where&#39;, &#39;filter_date_range_future&#39;)) remove_filter( &#39;posts_where&#39;, &#39;filter_date_range_future&#39;); [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[11],"tags":[],"class_list":["post-75","post","type-post","status-publish","format-standard","hentry","category-wordpress"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Remove custom filters in page with multiple query_posts - Branislav Pavlovic<\/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:\/\/www.btb4net.com\/borenblog\/remove-custom-filters-in-page-with-multiple-query_posts\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Remove custom filters in page with multiple query_posts - Branislav Pavlovic\" \/>\n<meta property=\"og:description\" content=\"There&nbsp;are&nbsp;situations where one page contains&nbsp;multiple post queries(function query_posts) for different conditions(parent categories, tags, etc.), and some of&nbsp;post queries&nbsp;have custom filters(added by add_filter function). Next&nbsp;query_posts&nbsp;call will keep this custom filters, and that could make totaly unespected posts results. Before execute next&nbsp;post query,&nbsp;please add this&nbsp;kind of&nbsp;code&nbsp;to remove previous custom filter, i.e.: if (has_filter(&#039;posts_where&#039;, &#039;filter_date_range_future&#039;)) remove_filter( &#039;posts_where&#039;, &#039;filter_date_range_future&#039;); [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.btb4net.com\/borenblog\/remove-custom-filters-in-page-with-multiple-query_posts\/\" \/>\n<meta property=\"og:site_name\" content=\"Branislav Pavlovic\" \/>\n<meta property=\"article:published_time\" content=\"2012-01-23T21:49:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-02-13T08:48:33+00:00\" \/>\n<meta name=\"author\" content=\"Pavlovi\u0107 Branislav\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Pavlovi\u0107 Branislav\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.btb4net.com\/borenblog\/remove-custom-filters-in-page-with-multiple-query_posts\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.btb4net.com\/borenblog\/remove-custom-filters-in-page-with-multiple-query_posts\/\"},\"author\":{\"name\":\"Pavlovi\u0107 Branislav\",\"@id\":\"https:\/\/www.btb4net.com\/borenblog\/#\/schema\/person\/1b2f711186b5e6d2f949b93ce659fa28\"},\"headline\":\"Remove custom filters in page with multiple query_posts\",\"datePublished\":\"2012-01-23T21:49:36+00:00\",\"dateModified\":\"2013-02-13T08:48:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.btb4net.com\/borenblog\/remove-custom-filters-in-page-with-multiple-query_posts\/\"},\"wordCount\":97,\"articleSection\":[\"Wordpress\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.btb4net.com\/borenblog\/remove-custom-filters-in-page-with-multiple-query_posts\/\",\"url\":\"https:\/\/www.btb4net.com\/borenblog\/remove-custom-filters-in-page-with-multiple-query_posts\/\",\"name\":\"Remove custom filters in page with multiple query_posts - Branislav Pavlovic\",\"isPartOf\":{\"@id\":\"https:\/\/www.btb4net.com\/borenblog\/#website\"},\"datePublished\":\"2012-01-23T21:49:36+00:00\",\"dateModified\":\"2013-02-13T08:48:33+00:00\",\"author\":{\"@id\":\"https:\/\/www.btb4net.com\/borenblog\/#\/schema\/person\/1b2f711186b5e6d2f949b93ce659fa28\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.btb4net.com\/borenblog\/remove-custom-filters-in-page-with-multiple-query_posts\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.btb4net.com\/borenblog\/remove-custom-filters-in-page-with-multiple-query_posts\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.btb4net.com\/borenblog\/remove-custom-filters-in-page-with-multiple-query_posts\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.btb4net.com\/borenblog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Remove custom filters in page with multiple query_posts\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.btb4net.com\/borenblog\/#website\",\"url\":\"https:\/\/www.btb4net.com\/borenblog\/\",\"name\":\"Branislav Pavlovic\",\"description\":\"My Portfolio\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.btb4net.com\/borenblog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.btb4net.com\/borenblog\/#\/schema\/person\/1b2f711186b5e6d2f949b93ce659fa28\",\"name\":\"Pavlovi\u0107 Branislav\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.btb4net.com\/borenblog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/62c17a10b5883b6f49efea84199811ef?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/62c17a10b5883b6f49efea84199811ef?s=96&d=mm&r=g\",\"caption\":\"Pavlovi\u0107 Branislav\"},\"url\":\"https:\/\/www.btb4net.com\/borenblog\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Remove custom filters in page with multiple query_posts - Branislav Pavlovic","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:\/\/www.btb4net.com\/borenblog\/remove-custom-filters-in-page-with-multiple-query_posts\/","og_locale":"en_US","og_type":"article","og_title":"Remove custom filters in page with multiple query_posts - Branislav Pavlovic","og_description":"There&nbsp;are&nbsp;situations where one page contains&nbsp;multiple post queries(function query_posts) for different conditions(parent categories, tags, etc.), and some of&nbsp;post queries&nbsp;have custom filters(added by add_filter function). Next&nbsp;query_posts&nbsp;call will keep this custom filters, and that could make totaly unespected posts results. Before execute next&nbsp;post query,&nbsp;please add this&nbsp;kind of&nbsp;code&nbsp;to remove previous custom filter, i.e.: if (has_filter(&#39;posts_where&#39;, &#39;filter_date_range_future&#39;)) remove_filter( &#39;posts_where&#39;, &#39;filter_date_range_future&#39;); [&hellip;]","og_url":"https:\/\/www.btb4net.com\/borenblog\/remove-custom-filters-in-page-with-multiple-query_posts\/","og_site_name":"Branislav Pavlovic","article_published_time":"2012-01-23T21:49:36+00:00","article_modified_time":"2013-02-13T08:48:33+00:00","author":"Pavlovi\u0107 Branislav","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Pavlovi\u0107 Branislav","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.btb4net.com\/borenblog\/remove-custom-filters-in-page-with-multiple-query_posts\/#article","isPartOf":{"@id":"https:\/\/www.btb4net.com\/borenblog\/remove-custom-filters-in-page-with-multiple-query_posts\/"},"author":{"name":"Pavlovi\u0107 Branislav","@id":"https:\/\/www.btb4net.com\/borenblog\/#\/schema\/person\/1b2f711186b5e6d2f949b93ce659fa28"},"headline":"Remove custom filters in page with multiple query_posts","datePublished":"2012-01-23T21:49:36+00:00","dateModified":"2013-02-13T08:48:33+00:00","mainEntityOfPage":{"@id":"https:\/\/www.btb4net.com\/borenblog\/remove-custom-filters-in-page-with-multiple-query_posts\/"},"wordCount":97,"articleSection":["Wordpress"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.btb4net.com\/borenblog\/remove-custom-filters-in-page-with-multiple-query_posts\/","url":"https:\/\/www.btb4net.com\/borenblog\/remove-custom-filters-in-page-with-multiple-query_posts\/","name":"Remove custom filters in page with multiple query_posts - Branislav Pavlovic","isPartOf":{"@id":"https:\/\/www.btb4net.com\/borenblog\/#website"},"datePublished":"2012-01-23T21:49:36+00:00","dateModified":"2013-02-13T08:48:33+00:00","author":{"@id":"https:\/\/www.btb4net.com\/borenblog\/#\/schema\/person\/1b2f711186b5e6d2f949b93ce659fa28"},"breadcrumb":{"@id":"https:\/\/www.btb4net.com\/borenblog\/remove-custom-filters-in-page-with-multiple-query_posts\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.btb4net.com\/borenblog\/remove-custom-filters-in-page-with-multiple-query_posts\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.btb4net.com\/borenblog\/remove-custom-filters-in-page-with-multiple-query_posts\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.btb4net.com\/borenblog\/"},{"@type":"ListItem","position":2,"name":"Remove custom filters in page with multiple query_posts"}]},{"@type":"WebSite","@id":"https:\/\/www.btb4net.com\/borenblog\/#website","url":"https:\/\/www.btb4net.com\/borenblog\/","name":"Branislav Pavlovic","description":"My Portfolio","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.btb4net.com\/borenblog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.btb4net.com\/borenblog\/#\/schema\/person\/1b2f711186b5e6d2f949b93ce659fa28","name":"Pavlovi\u0107 Branislav","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.btb4net.com\/borenblog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/62c17a10b5883b6f49efea84199811ef?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/62c17a10b5883b6f49efea84199811ef?s=96&d=mm&r=g","caption":"Pavlovi\u0107 Branislav"},"url":"https:\/\/www.btb4net.com\/borenblog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.btb4net.com\/borenblog\/wp-json\/wp\/v2\/posts\/75","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.btb4net.com\/borenblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.btb4net.com\/borenblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.btb4net.com\/borenblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.btb4net.com\/borenblog\/wp-json\/wp\/v2\/comments?post=75"}],"version-history":[{"count":15,"href":"https:\/\/www.btb4net.com\/borenblog\/wp-json\/wp\/v2\/posts\/75\/revisions"}],"predecessor-version":[{"id":348,"href":"https:\/\/www.btb4net.com\/borenblog\/wp-json\/wp\/v2\/posts\/75\/revisions\/348"}],"wp:attachment":[{"href":"https:\/\/www.btb4net.com\/borenblog\/wp-json\/wp\/v2\/media?parent=75"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.btb4net.com\/borenblog\/wp-json\/wp\/v2\/categories?post=75"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.btb4net.com\/borenblog\/wp-json\/wp\/v2\/tags?post=75"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}