Automattic\WooCommerce\Blocks\BlockTypes
ProductQuery::initialize()
Initialize this block type.
- Hook into WP lifecycle.
- Register the block with WordPress.
- Hook into pre_render_block to update the query.
Method of the class: ProductQuery{}
No Hooks.
Return
null
. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->initialize();
ProductQuery::initialize() ProductQuery::initialize code WC 9.6.1
protected function initialize() { add_filter( 'query_vars', array( $this, 'set_query_vars' ) ); parent::initialize(); add_filter( 'pre_render_block', array( $this, 'update_query' ), 10, 2 ); add_filter( 'render_block', array( $this, 'enqueue_styles' ), 10, 2 ); add_filter( 'rest_product_query', array( $this, 'update_rest_query' ), 10, 2 ); add_filter( 'rest_product_collection_params', array( $this, 'extend_rest_query_allowed_params' ), 10, 1 ); }