Skip to content
mcLogiora0.16.0
0.16.01 min read

Public PHP API

Use the stable mclogiora_ read functions and language switcher template tags.

The public PHP API uses mclogiora_ names, plain arrays, and scalars. It does not expose domain objects. Readers are safe before boot, with no languages, or before the schema is installed: they return an empty array or null.

Read functions

Code
mclogiora_get_languages( array $args = array() );
mclogiora_get_default_language();
mclogiora_get_current_language();
mclogiora_get_translation( int $object_id, string $object_type, string $language );
mclogiora_get_translation_group( int $object_id, string $object_type );
mclogiora_get_language_url( string $language, ?int $object_id = null, string $object_type = 'post', string $taxonomy = '' );

mclogiora_get_language_url() returns null when a translation does not exist. A returned object ID is a relation record, not permission to display that object; apply your own WordPress capability and visibility checks.

Template tags

Code
mclogiora_language_switcher( array $args = array() );
mclogiora_the_language_switcher( array $args = array() );
mclogiora_current_language();

mclogiora_language_switcher() is the supported name. The planned mclogiora_render_language_switcher() name is not a public contract.

Related articles