WordPress REST API – returning incorrect locale
-
I have a contact form that uses WP REST api, I return custom json response + using WP string translation function __()
$response = array( 'status' => 'mailsent', 'message' => array(), 'pg_message' => __( 'One or more fields have an error. Please verify your entries and try again.', 'theme' ), );
I am expecting French locale but I get the default wp-admin locale returned instead(en_CA).
Forcing switch_to_locale(‘fr_CA’) function in functions.php I can get french translation to work but looking for a proper solution to this.
Thanks!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘WordPress REST API – returning incorrect locale’ is closed to new replies.