Skip to main content
Oops, there are two relevant wp_insert_term()s
Source Link
Rup
  • 4.4k
  • 4
  • 28
  • 29

Here's the relevant codeHere's the relevant code (lines 13, 17 and 18):

$term = wp_insert_term(sanitize_text_field(
    $_POST['Color_Name']), 'product_color', $args);
$wc_term = wp_insert_term(sanitize_text_field(
    $_POST['Color_Name']), 'pa_ewd_uwcf_colors', $args);
update_term_meta($term['term_id'], 'EWD_UWCF_WC_Term_ID', $wc_term['term_id']);

You can see from the stack trace that either $term or $wc_term here must be a WP_Error object meaning that one of the wp_insert_term call() calls failed. It would be useful to find out what that error is: I'd suggest adding

error_log( print_r( $term, true ) );
error_log( print_r( $wc_term, true ) );

between those two lines and reproducing the error again, then check your server or PHP error log to see the error details. After that I suggest you talk to the plugin authors and ask them to check is_wp_error($term) and is_wp_error($wc_term) here, and give them the error details too.

Here's the relevant code:

$wc_term = wp_insert_term(sanitize_text_field($_POST['Color_Name']), 'pa_ewd_uwcf_colors', $args);
update_term_meta($term['term_id'], 'EWD_UWCF_WC_Term_ID', $wc_term['term_id']);

You can see from the stack trace that $wc_term here must be a WP_Error object meaning that the wp_insert_term call failed. It would be useful to find out what that error is: I'd suggest adding

error_log( print_r( $wc_term, true ) );

between those two lines and reproducing the error again, then check your server or PHP error log to see the error details. After that I suggest you talk to the plugin authors and ask them to check is_wp_error($wc_term) here, and give them the error details too.

Here's the relevant code (lines 13, 17 and 18):

$term = wp_insert_term(sanitize_text_field(
    $_POST['Color_Name']), 'product_color', $args);
$wc_term = wp_insert_term(sanitize_text_field(
    $_POST['Color_Name']), 'pa_ewd_uwcf_colors', $args);
update_term_meta($term['term_id'], 'EWD_UWCF_WC_Term_ID', $wc_term['term_id']);

You can see from the stack trace that either $term or $wc_term here must be a WP_Error object meaning that one of the wp_insert_term() calls failed. It would be useful to find out what that error is: I'd suggest adding

error_log( print_r( $term, true ) );
error_log( print_r( $wc_term, true ) );

between those two lines and reproducing the error again, then check your server or PHP error log to see the error details. After that I suggest you talk to the plugin authors and ask them to check is_wp_error($term) and is_wp_error($wc_term) here, and give them the error details too.

Source Link
Rup
  • 4.4k
  • 4
  • 28
  • 29

Here's the relevant code:

$wc_term = wp_insert_term(sanitize_text_field($_POST['Color_Name']), 'pa_ewd_uwcf_colors', $args);
update_term_meta($term['term_id'], 'EWD_UWCF_WC_Term_ID', $wc_term['term_id']);

You can see from the stack trace that $wc_term here must be a WP_Error object meaning that the wp_insert_term call failed. It would be useful to find out what that error is: I'd suggest adding

error_log( print_r( $wc_term, true ) );

between those two lines and reproducing the error again, then check your server or PHP error log to see the error details. After that I suggest you talk to the plugin authors and ask them to check is_wp_error($wc_term) here, and give them the error details too.