Posted 'text' terms are not slugs. Only striptags/slashes - don't change to slugs. Closes #2955.

This commit is contained in:
Mike Jolley 2013-04-15 13:15:42 +01:00
parent 85f98e48c7
commit ba0b4196fa
3 changed files with 11 additions and 7 deletions

View File

@ -749,12 +749,13 @@ function woocommerce_process_product_meta( $post_id, $post ) {
if ( isset( $attribute_values[ $i ] ) ) {
// Format values (posted values are slugs)
// Select based attributes - Format values (posted values are slugs)
if ( is_array( $attribute_values[ $i ] ) ) {
$values = array_map( 'sanitize_title', $attribute_values[ $i ] );
// Text based attributes - Posted values are term names - don't change to slugs
} else {
// Text based, separate by pipe
$values = array_map( 'sanitize_title', explode( '|', $attribute_values[ $i ] ) );
$values = array_map( 'stripslashes', array_map( 'strip_tags', explode( '|', $attribute_values[ $i ] ) ) );
}
// Remove empty items in the array

View File

@ -168,7 +168,9 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
= X =
* Feature - Related products shortcode.
* Tweak - Support for the city field in shipping calc (filterable).
* Fix - Updated shareyourcart SDK.
* Fix - moved woocommerce_get_filename_from_url to core-functions as it is required in admin too.
* Fix - checkmark after adding to cart multiple times.
= 2.0.7 - 12/04/2013 =
* Feature - Option for GA _setDomainName.

View File

@ -442,12 +442,13 @@ function woocommerce_save_attributes() {
if ( isset( $attribute_values[ $i ] ) ) {
// Format values (slug format)
// Select based attributes - Format values (posted values are slugs)
if ( is_array( $attribute_values[ $i ] ) ) {
$values = array_map( 'sanitize_title', array_map( 'stripslashes', $attribute_values[ $i ] ) );
$values = array_map( 'sanitize_title', $attribute_values[ $i ] );
// Text based attributes - Posted values are term names - don't change to slugs
} else {
// Text based, separate by pipe
$values = array_map( 'sanitize_title', array_map( 'stripslashes', explode( '|', $attribute_values[ $i ] ) ) );
$values = array_map( 'stripslashes', array_map( 'strip_tags', explode( '|', $attribute_values[ $i ] ) ) );
}
// Remove empty items in the array