Automattic\WooCommerce\Blocks
BlockTemplatesController::dont_load_templates_for_suggestions
When creating a template from the WP suggestion, don't load the templates with the WooCommerce slug. Otherwise they take precedence and the new template can't be created.
Метод класса: BlockTemplatesController{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$BlockTemplatesController = new BlockTemplatesController(); $BlockTemplatesController->dont_load_templates_for_suggestions( $prepared_post );
- $prepared_post(stdClass) (обязательный)
- An object representing a single post prepared for inserting or updating the database.
Код BlockTemplatesController::dont_load_templates_for_suggestions() BlockTemplatesController::dont load templates for suggestions WC 10.9.1
public function dont_load_templates_for_suggestions( $prepared_post ) {
if ( isset( $prepared_post->meta_input['is_wp_suggestion'] ) ) {
remove_filter( 'get_block_templates', array( $this, 'add_db_templates_with_woo_slug' ), 10, 3 );
}
return $prepared_post;
}