Title: ngettext_with_context
Published: April 25, 2014
Last modified: February 24, 2026

---

# apply_filters( ‘ngettext_with_context’, string $translation, string $single, string $plural, int $number, string $context, string $domain )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/ngettext_with_context/?output_format=md#parameters)
 * [More Information](https://developer.wordpress.org/reference/hooks/ngettext_with_context/?output_format=md#more-information)
 * [Source](https://developer.wordpress.org/reference/hooks/ngettext_with_context/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/ngettext_with_context/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/ngettext_with_context/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/ngettext_with_context/?output_format=md#wp--skip-link--target)

Filters the singular or plural form of a string with gettext context.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/ngettext_with_context/?output_format=md#parameters)󠁿

 `$translation`string

Translated text.

`$single`string

The text to be used if the number is singular.

`$plural`string

The text to be used if the number is plural.

`$number`int

The number to compare against to use either the singular or plural form.

`$context`string

Context information for the translators.

`$domain`string

Text domain. Unique identifier for retrieving translated strings.

## 󠀁[More Information](https://developer.wordpress.org/reference/hooks/ngettext_with_context/?output_format=md#more-information)󠁿

This filter hook is applied to the translated text by the internationalization function
that handle contexts and plurals at the same time (`[_nx()](https://developer.wordpress.org/reference/functions/_nx/)`).

**IMPORTANT:** This filter is always applied even if internationalization is not
in effect, and if the text domain has not been loaded. If there are functions hooked
to this filter, they will always run. This could lead to a performance problem.

For regular translation functions such as `[_e()](https://developer.wordpress.org/reference/functions/_e/)`,
and for examples on usage, see `[gettext()](https://developer.wordpress.org/reference/hooks/gettext/)`.

For singular/plural aware translation functions such as `[_n()](https://developer.wordpress.org/reference/functions/_n/)`,
see `[ngettext()](https://developer.wordpress.org/reference/hooks/ngettext/)`.

For context-specific translation functions such as `[_x()](https://developer.wordpress.org/reference/functions/_x/)`,
see filter hook [`gettext_with_context()`](https://developer.wordpress.org/reference/hooks/gettext_with_context/).

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/ngettext_with_context/?output_format=md#source)󠁿

    ```php
    $translation = apply_filters( 'ngettext_with_context', $translation, $single, $plural, $number, $context, $domain );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/l10n.php#L558)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/l10n.php#L558-L558)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/ngettext_with_context/?output_format=md#related)󠁿

| Used by | Description | 
| [_nx()](https://developer.wordpress.org/reference/functions/_nx/)`wp-includes/l10n.php` |

Translates and retrieves the singular or plural form based on the supplied number, with gettext context.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/ngettext_with_context/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fngettext_with_context%2F)
before being able to contribute a note or feedback.