WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/wp dropdown languages

Description

Display or retrieve the HTML dropdown list of languages.

Usage

 <?php wp_dropdown_languages$args ); ?> 

Default Usage

<?php $args = array(
        'id'           => '',
        'name'         => '',
        'languages'    => array(),
        'translations' => array(),
        'selected'     => '',
        'echo'         => 1,
        'show_available_translations' => true,
); ?>

Parameters

$args
(string|array) (optional) Override default arguments.
Default:

Return Values

(string) 
HTML content only if 'echo' argument is 0.

Arguments

id
(string) (optional) ID attribute of the select element.
Default: None
name
(string) (optional) Name attribute of the select element.
Default: None
languages
(array) (optional) List of installed languages, contain only the locales.
Default: None
translations
(array) (optional) List of available translations. Default result of wp_get_available_translations().
Default: None
selected
(string) (optional) Language which should be selected.
Default: None
boolean
(array) (optional) Whether to echo or return the generated markup. Accepts 0, 1, or their bool equivalents. Default 1.
Default: None
show_available_translations
(boolean) (optional) Whether to show available translations. Default true.
Default: None

Change Log

  • Since: 4.0.0
  • Since: 4.3.0 Introduced the echo argument.

Source File

wp_dropdown_languages() is located in wp-includes/l10n.php#L890.

Related

List & Dropdown Functions

See also index of Function Reference and index of Template Tags.