پرش به محتویات

"Filter: bricks/element/builder_setup_query"

آرگومان‌های Query مورد استفاده برای تنظیم زمینه پیش‌نمایش در سازنده را فیلتر می‌کند (به عنوان مثال، زمانی که «پر کردن محتوا» فعال است).

پارامترها

  • $query_args (array): Array of arguments passed to WP_Query.
  • $post_id (int): The ID of the template being edited.

نمونه استفاده

add_filter( 'bricks/element/builder_setup_query', function( $query_args, $post_id ) {
    // Example: If editing a specific template, force a specific post for preview
    if ( $post_id === 123 ) {
        $query_args['p'] = 456;
        $query_args['post_type'] = 'post';
    }

    return $query_args;
}, 10, 2 );