Title: Add new language programmatically
Last modified: January 2, 2020

---

# Add new language programmatically

 *  [flickeringpixel](https://wordpress.org/support/users/flickeringpixel/)
 * (@flickeringpixel)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/add-new-language-programmatically/)
 * Hello,
 * Is there a way of adding new languages to a site programmatically, via the functions.
   php for example.
 * For each new language I wouldn’t need to edit/customise it – just check to see
   if it’s already been added and, if not, add it.
 * Many thanks,
    Chris

Viewing 1 replies (of 1 total)

 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/add-new-language-programmatically/#post-12287489)
 * Hello,
 * A language can be added this way:
 *     ```
       $options = get_option( 'polylang' );
       $model = new PLL_Admin_Model( $options );
       $model->add_language( $args );
       ```
   
 * For the documentation of what to enter in the array $args, see the description
   of the method `add_language`: [https://github.com/polylang/polylang/blob/master/admin/admin-model.php#L10-L30](https://github.com/polylang/polylang/blob/master/admin/admin-model.php#L10-L30)
 * This method is for example used to create languages in our phpunit tests: [https://github.com/polylang/polylang/blob/2.6.8/tests/phpunit/includes/testcase.php#L33-L43](https://github.com/polylang/polylang/blob/2.6.8/tests/phpunit/includes/testcase.php#L33-L43)

Viewing 1 replies (of 1 total)

The topic ‘Add new language programmatically’ is closed to new replies.

 * ![](https://ps.w.org/polylang/assets/icon-256x256.png?rev=3433336)
 * [Polylang](https://wordpress.org/plugins/polylang/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/polylang/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/polylang/)
 * [Active Topics](https://wordpress.org/support/plugin/polylang/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/polylang/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/polylang/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Chouby](https://wordpress.org/support/users/chouby/)
 * Last activity: [6 years, 4 months ago](https://wordpress.org/support/topic/add-new-language-programmatically/#post-12287489)
 * Status: not resolved