Damiano Barbati
Damiano Barbati

Reputation: 3496

Changing wordpress language through API

I need to deploy sixteen wordpress instances at once and nope, wordpress network is not an option.

I'm trying to customize each instance language programmatically after its deploy. I managed to customize anything else I need.

Neither of these solutions seem to work:

  1. set $locale="es_ES" in wp-config.php
  2. update_option("WPLANG", "es_ES") //return false
  3. update_blog_option(1, "WPLANG", "es_ES") //return false
  4. update_site_option("WPLANG", "es_ES") //just for network, but at least returns true but setting wplang option to null

Language keeps being the default english. Any solution?

EDIT:

Kevin was actually right. You need to:

1) Download the correct language pack (.mo files) from http://wpcentral.io/internationalization/

2) update wp_options set option_value = "de_DE" where option_name = "wplang";

I thought I need not to download anything since you can set any language in the admin panel, but digging in the code I found out that wordpress is download files under the scenes.

Upvotes: 1

Views: 1043

Answers (1)

Kevin Ohashi
Kevin Ohashi

Reputation: 58

Have you read https://codex.wordpress.org/Installing_WordPress_in_Your_Language ?

From reading it, you need to upload .mo files in the proper directory beforehand. From there, depends on the version of WordPress, either wp-config or database change.

Upvotes: 1

Related Questions