From 34844a2254e477fb874c4e0a4d1b4fa563b097ca Mon Sep 17 00:00:00 2001 From: zippa71 <48920796+zippa71@users.noreply.github.com> Date: Sat, 5 Nov 2022 16:36:12 +0300 Subject: [PATCH 1/3] Create gw-set-product-category.php There are several drop down fields. Each subsequent one is filled from the parent by Term_ID using populate anything. In the feed settings, when using this code, you can not specify in which categories the product will be recorded. --- gravity-forms/gw-set-product-category.php | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 gravity-forms/gw-set-product-category.php diff --git a/gravity-forms/gw-set-product-category.php b/gravity-forms/gw-set-product-category.php new file mode 100644 index 000000000..6e781746c --- /dev/null +++ b/gravity-forms/gw-set-product-category.php @@ -0,0 +1,9 @@ + Date: Wed, 9 Nov 2022 09:57:07 -0500 Subject: [PATCH 2/3] Update and rename gravity-forms/gw-set-product-category.php to experimental/gw-gfapc-map-multiple-fields-to-taxonomy.php --- ...-gfapc-map-multiple-fields-to-taxonomy.php | 28 +++++++++++++++++++ gravity-forms/gw-set-product-category.php | 9 ------ 2 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 experimental/gw-gfapc-map-multiple-fields-to-taxonomy.php delete mode 100644 gravity-forms/gw-set-product-category.php diff --git a/experimental/gw-gfapc-map-multiple-fields-to-taxonomy.php b/experimental/gw-gfapc-map-multiple-fields-to-taxonomy.php new file mode 100644 index 000000000..9a49651f8 --- /dev/null +++ b/experimental/gw-gfapc-map-multiple-fields-to-taxonomy.php @@ -0,0 +1,28 @@ + Date: Thu, 10 Nov 2022 13:58:27 -0500 Subject: [PATCH 3/3] Update gw-gfapc-map-multiple-fields-to-taxonomy.php --- experimental/gw-gfapc-map-multiple-fields-to-taxonomy.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/experimental/gw-gfapc-map-multiple-fields-to-taxonomy.php b/experimental/gw-gfapc-map-multiple-fields-to-taxonomy.php index 9a49651f8..2d58f5e59 100644 --- a/experimental/gw-gfapc-map-multiple-fields-to-taxonomy.php +++ b/experimental/gw-gfapc-map-multiple-fields-to-taxonomy.php @@ -3,7 +3,7 @@ * Gravity Wiz // Gravity Forms // Map Multiple Fields w/ Advanced Post Creation * https://gravitywiz.com/ * - * By default, the Advanced Post Creation add-on does not allow you to map multiple fields to a taxonomy nor does it + * By default, the Advanced Post Creation add-on does not allow you to map multiple fields to a taxonomy nor does it * allow you to set terms by ID. * * This snippet allows to specify multiple fields on a form that have been populated with term IDs (we recommend @@ -15,12 +15,13 @@ // Update "1", "2", "3" to the field IDs that have been populated with terms. Add additional IDs as needed. $term_field_ids = array( 1, 2, 3 ); + // Update "categories" to the name of the taxonomy to which the populated terms belong. - $taxonomy = 'categories'; + $taxonomy = 'categories'; $term_ids = array(); foreach ( $term_field_ids as $term_field_id ) { - $term_ids[] = $entry[ $term_field_id ]; + $term_ids[] = (int) $entry[ $term_field_id ]; } wp_set_object_terms( $post_id, $term_ids, $taxonomy );