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

Function Reference/ 2ngettext

This page is named incorrectly due to a limitation of Mediawiki page naming. The function name is __ngettext not _2ngettext.

This function has been deprecated since Version 2.8. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists. See also wp-includes/deprecated.php. Use _n instead.


Retrieve the plural or single form based on the amount.

If the domain is not set in the $l10n list, then a comparsion will be made and either $plural or $single parameters returned.

If the domain does exist, then the parameters $single, $plural, and $number will first be passed to the domain's ngettext method. Then it will be passed to the 'ngettext' filter hook along with the same parameters. The expected type will be a string.


<?php __ngettext$single$plural$number$domain ?>


(string) (required) The text that will be used if $number is 1
Default: None
(string) (required) The text that will be used if $number is not 1
Default: None
(integer) (required) The number to compare against to use either $single or $plural
Default: None
(string) (optional) The domain identifier the text should be retrieved in
Default: 'default'

Return Values

Either $single or $plural translated text



  • Uses: apply_filters() Calls 'ngettext' hook on domains text returned, along with $single, $plural, and $number parameters. Expected to return string.
  • Uses global: (array) $l10n Gets list of domain translated string (gettext_reader) objects.
  • l10n is an abbreviation for localization.
  • This function name has two leading underscores in a row. In some fonts it looks like one long underscore.

Change Log

  • Since: 1.2.0
  • Deprecated: 2.8.0

Source File

__ngettext() was located in wp-includes/l10n.php. As of Version 2.8 it was moved to wp-includes/deprecated.php.


L10n: translate(), __(), _e(), _n(), _x(), _ex(), _nx(), esc_attr__(), esc_attr_e(), esc_attr_x(), esc_html__(), esc_html_e(), esc_html_x(), _n_noop(), _nx_noop(), translate_nooped_plural()

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