"Filter: bricks/query_filters_indexer/post/wcField"
یک قلاب تخصصی برای Query Filters Indexer برای ایجاد ردیفهای شاخص برای فیلدهای محصول WooCommerce (مانند قیمت، وضعیت سهام، رتبهبندی) هنگام پردازش یک کار فیلتر.
پارامترها
$rows(array): Array of index rows to be inserted. Default is[].$post(WP_Post|int): The product object or ID being indexed.$filter_id(string): The ID of the filter element.$filter_settings(array): The settings of the filter element.
نمونه استفاده
add_filter( 'bricks/query_filters_indexer/post/wcField', function( $rows, $post, $filter_id, $filter_settings ) {
// This filter is typically used internally by Bricks to handle WooCommerce fields.
// However, you could hook into it to index custom WooCommerce product data via the 'wcField' source.
// Check if indexing a specific custom WC field
if ( isset( $filter_settings['sourceFieldType'] ) && $filter_settings['sourceFieldType'] === 'my_custom_wc_field' ) {
// ... generate and return rows ...
}
return $rows;
}, 10, 4 );