Skip to content

Commit

Permalink
Enforce slug format of translated edit-address-slugs.
Browse files Browse the repository at this point in the history
Fixes issues with addresses not loading correctly in edit account.
  • Loading branch information
mikejolley committed Oct 22, 2014
1 parent bb7f580 commit 06aca23
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion includes/class-wc-form-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static function save_address() {
return;
}

$load_address = isset( $wp->query_vars['edit-address'] ) ? wc_edit_address_i18n( sanitize_key( $wp->query_vars['edit-address'] ), true ) : 'billing';
$load_address = isset( $wp->query_vars['edit-address'] ) ? wc_edit_address_i18n( sanitize_title( $wp->query_vars['edit-address'] ), true ) : 'billing';

$address = WC()->countries->get_address_fields( esc_attr( $_POST[ $load_address . '_country' ] ), $load_address . '_' );

Expand Down
4 changes: 2 additions & 2 deletions includes/wc-page-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ function wc_get_endpoint_url( $endpoint, $value = '', $permalink = '' ) {
*/
function wc_edit_address_i18n( $id, $flip = false ) {
$slugs = apply_filters( 'woocommerce_edit_address_slugs', array(
'billing' => _x( 'billing', 'edit-address-slug', 'woocommerce' ),
'shipping' => _x( 'shipping', 'edit-address-slug', 'woocommerce' )
'billing' => sanitize_title( _x( 'billing', 'edit-address-slug', 'woocommerce' ) ),
'shipping' => sanitize_title( _x( 'shipping', 'edit-address-slug', 'woocommerce' ) )
) );

if ( $flip ) {
Expand Down

0 comments on commit 06aca23

Please sign in to comment.