Automattic\WooCommerce\Blocks\BlockTypes
RelatedProducts::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: RelatedProducts{}
No Hooks.
Returns
null. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->initialize();
RelatedProducts::initialize() RelatedProducts::initialize code WC 10.5.0
protected function initialize() {
parent::initialize();
add_filter(
'pre_render_block',
array( $this, 'update_query' ),
10,
2
);
add_filter(
'render_block',
array( $this, 'render_block' ),
10,
2
);
}