Removing Extra Commas from Geolocation Input
-
The code you previously provided made the Country and City fields optional, and changed the Address field to accept latitude and longitude. However, after making these fields optional, I noticed that when navigating to the location using the latitude and longitude, two extra commas (,,) appear after the coordinates. Is there a way to remove these extra commas?
add_filter( 'wpsl_meta_box_fields', 'custom_meta_box_fields' );
function custom_meta_box_fields( $meta_fields ) {
/**
* If no 'type' is defined it will show a normal text input field.
*
* Supported field types are checkbox, textarea and dropdown.
*/
$meta_fields[ __( 'Location', 'wpsl' ) ] = array(
'address' => array(
'label' => __( 'Address', 'wpsl' ),
),
'address2' => array(
'label' => __( 'Address 2', 'wpsl' )
),
'city' => array(
'label' => __( 'City', 'wpsl' ),
),
'state' => array(
'label' => __( 'State', 'wpsl' )
),
'zip' => array(
'label' => __( 'Zip Code', 'wpsl' )
),
'country' => array(
'label' => __( 'Country', 'wpsl' )
),
'country_iso' => array(
'type' => 'hidden'
),
'lat' => array(
'label' => __( 'Latitude', 'wpsl' )
),
'lng' => array(
'label' => __( 'Longitude', 'wpsl' )
)
);
return $meta_fields;
}The page I need help with: [log in to see the link]
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Removing Extra Commas from Geolocation Input’ is closed to new replies.