> For the complete documentation index, see [llms.txt](https://developers.weglot.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.weglot.com/cms/wordpress/helpers-functions.md).

# Helpers Functions

All Weglot functions you can call in WordPress to get informations

## Helpers Functions

Weglot plugin is exposing functions that can be called in your code.

To see the source code of all available functions, you can go to the file : **weglot-functions.php.**

{% hint style="warning" %}
Make sure your plugin's version is > 3.0
{% endhint %}

#### weglot\_get\_service

```php
weglot_get_service( string $service )
```

Return a Weglot service.

#### weglot\_get\_options

```php
weglot_get_options()
```

Return all Weglot options.

#### weglot\_get\_option

```php
weglot_get_option( string $key )
```

Return Weglot option by key.

#### weglot\_get\_original\_language

```php
weglot_get_original_language()
```

Return the original language code (2-letter internal code, e.g. `en`).

#### weglot\_get\_current\_language

```php
weglot_get_current_language()
```

Return the current language **internal** code (2-letter code, e.g. `en`). This is the code Weglot uses internally, not the one that may appear in your URLs.

#### weglot\_get\_current\_language\_custom

```php
weglot_get_current_language_custom()
```

Return the current language **external** code — the custom language code configured in your Weglot dashboard (falls back to the standard code when none is set). Use this when you need the code as it appears to your visitors.

{% hint style="info" %}
`weglot_get_current_language_code_from_custom_language()` is an alias that returns the exact same value.
{% endhint %}

#### weglot\_get\_destination\_languages

```php
weglot_get_destination_languages()
```

Return an array of public destination language keys.

#### weglot\_get\_request\_url\_service

```php
weglot_get_request_url_service()
```

Return weglot request URL service.

#### weglot\_get\_languages\_available

```php
weglot_get_languages_available()
```

Return an array of all languages objects available.

#### weglot\_get\_button\_selector\_html

```php
weglot_get_button_selector_html( string $add_class = '' )
```

Return the language's selector button HTML in string format.

#### weglot\_get\_exclude\_urls

```php
weglot_get_exclude_urls()
```

Return an array of all excluded URLs.

#### weglot\_get\_translate\_amp\_translation

```php
weglot_get_translate_amp_translation()
```

Return `true` if amp pages translation is activated.

#### weglot\_get\_current\_full\_url

```php
weglot_get_current_full_url()
```

Return a string of current URL.

#### weglot\_create\_url\_object

```php
weglot_create_url_object( string $url )
```

Return a `Weglot\Util\Url` object for the given URL. Call `->getForLanguage( $language )` on it to get the URL translated into a specific language.

#### weglot\_is\_eligible\_url

```php
weglot_is_eligible_url( string $url )
```

Return `true` if `$url` is an eligible URL.

#### weglot\_get\_api\_key

```php
weglot_get_api_key()
```

Return a string of private API key.

#### weglot\_has\_auto\_redirect

```php
weglot_has_auto_redirect()
```

Return `true` if redirect users based on their browser language option is activated.

#### weglot\_get\_full\_url\_no\_language

```php
weglot_get_full_url_no_language()
```

Return a string of current URL without the language key.

#### weglot\_get\_postid\_from\_url

```php
weglot_get_postid_from_url()
```

Return the WordPress post ID matching the current URL, or `0` if none is found.

#### weglot\_get\_rest\_current\_url\_path

```php
weglot_get_rest_current_url_path()
```

Return a string of rest current URL path.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.weglot.com/cms/wordpress/helpers-functions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
