acf-city-selector
acf-city-selector copied to clipboard
Transient bypasses WP localization function
It's impossible to translate states. The function acfcs_get_states()
in acfcs-functions.php
has the localization function buried in code that is bypassed by transient.
$transient = get_transient( 'acfcs_states_' . strtolower( $country_code ) );
if ( false == $transient || is_array( $transient ) && empty( $transient ) ) {
$order = ' ORDER BY state_name ASC';
if ( 'FR' == $country_code ) {
$order = " ORDER BY LENGTH(state_name), state_name";
}
global $wpdb;
$table = $wpdb->prefix . 'cities';
$sql = $wpdb->prepare( "SELECT * FROM $table WHERE country_code = %s GROUP BY state_code" . $order, strtoupper( $country_code ) );
$results = $wpdb->get_results( $sql );
$state_results = array();
foreach ( $results as $data ) {
$state_results[ strtoupper( $country_code ) . '-' . $data->state_code ] = esc_attr__( $data->state_name, 'acf-city-selector' );
}
Can't you just clear the transients so they're rebuilt ?
The only way that will work is if the site is just one language. It won't work on a multilingual site.
But it should generate a transient for each language code ? Is that not happening ?
I haven't visited this topic in a while... @mikezeb can you maybe clarify your issue a bit more ?