Send back correct slug after adding term

Fixes #7685
This commit is contained in:
Mike Jolley 2015-03-13 09:21:55 +00:00
parent c44100f9e7
commit 10c047d38a
1 changed files with 5 additions and 4 deletions

View File

@ -452,7 +452,7 @@ class WC_AJAX {
check_ajax_referer( 'add-attribute', 'security' );
$taxonomy = esc_attr( $_POST['taxonomy'] );
$term = stripslashes( $_POST['term'] );
$term = wc_clean( $_POST['term'] );
if ( taxonomy_exists( $taxonomy ) ) {
@ -463,10 +463,11 @@ class WC_AJAX {
'error' => $result->get_error_message()
) );
} else {
$term = get_term_by( 'id', $result['term_id'], $taxonomy );
wp_send_json( array(
'term_id' => $result['term_id'],
'name' => $term,
'slug' => sanitize_title( $term ),
'term_id' => $term->term_id,
'name' => $term->name,
'slug' => $term->slug
) );
}
}