Automattic\WooCommerce\Internal\Admin
CategoryLookup::get_term_insert_values()
Used to construct insert query recursively.
Method of the class: CategoryLookup{}
No Hooks.
Return
null
. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->get_term_insert_values( $inserts, $terms, $parents );
- $inserts(array) (required) (passed by reference — &)
- Array of data to insert.
- $terms(array) (required)
- Terms to insert.
- $parents(array)
- Parent IDs the terms belong to.
Default: array()
CategoryLookup::get_term_insert_values() CategoryLookup::get term insert values code WC 8.7.0
protected function get_term_insert_values( &$inserts, $terms, $parents = array() ) { foreach ( $terms as $term ) { $insert_parents = array_merge( array( $term['term_id'] ), $parents ); foreach ( $insert_parents as $parent ) { $inserts[] = array( $parent, $term['term_id'], ); } $this->get_term_insert_values( $inserts, $term['descendants'], $insert_parents ); } }