{"id":14015,"date":"2025-09-04T20:42:24","date_gmt":"2025-09-04T17:42:24","guid":{"rendered":"https:\/\/creativethemes.com\/blocksy\/?post_type=documentation&#038;p=14015"},"modified":"2025-09-10T14:13:07","modified_gmt":"2025-09-10T11:13:07","slug":"custom-queries-for-advanced-posts-blocks","status":"publish","type":"documentation","link":"https:\/\/creativethemes.com\/blocksy\/docs\/code-snippets\/custom-queries-for-advanced-posts-blocks\/","title":{"rendered":"Custom Queries for Advanced Posts blocks"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"3360\" height=\"2204\" src=\"https:\/\/creativethemes.com\/blocksy\/wp-content\/uploads\/2025\/09\/Screenshot-2025-09-04-at-20.34.48.png\" alt=\"\" class=\"wp-image-14016\" \/><\/figure>\n\n\n\n<p>Grab the Block ID from the editor sidebar when editing an Advanced Posts block, then paste it instead of the placeholder in the snippet below. You must know your way around WP_Query to implement this.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>add_filter(\n\t'blocksy:general:blocks:query:args',\n\tfunction ($query_args, $attributes) {\n\t\tif (\n\t\t\tisset($attributes&#091;'uniqueId'])\n\t\t\t&amp;&amp;\n\t\t\t$attributes&#091;'uniqueId'] === 'PLACEHOLDER'\n\t\t) {\n\t\t\t\/\/ Modify $query_args here\n\t\t}\n\n\t\treturn $query_args;\n\t},\n\t10,\n\t2\n);<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Grab the Block ID from the editor sidebar when editing an Advanced Posts block, then paste it instead of the placeholder in the snippet below. You must know your way around WP_Query to implement this.<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"doc_categories":[125],"class_list":["post-14015","documentation","type-documentation","status-publish","hentry","doc_categories-code-snippets"],"blocksy_meta":[],"acf":[],"_links":{"self":[{"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/documentation\/14015","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/documentation"}],"about":[{"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/types\/documentation"}],"author":[{"embeddable":true,"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/comments?post=14015"}],"version-history":[{"count":5,"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/documentation\/14015\/revisions"}],"predecessor-version":[{"id":14184,"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/documentation\/14015\/revisions\/14184"}],"wp:attachment":[{"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/media?parent=14015"}],"wp:term":[{"taxonomy":"doc_categories","embeddable":true,"href":"https:\/\/creativethemes.com\/blocksy\/wp-json\/wp\/v2\/doc_categories?post=14015"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}