Title: WP_Translation_File::get_plural_form
Published: April 3, 2024
Last modified: May 20, 2026

---

# WP_Translation_File::get_plural_form( int $number ): int

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_translation_file/get_plural_form/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_translation_file/get_plural_form/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_translation_file/get_plural_form/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_translation_file/get_plural_form/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_translation_file/get_plural_form/?output_format=md#changelog)

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

Returns the plural form for a given number.

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

 `$number`intrequired

Count.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_translation_file/get_plural_form/?output_format=md#return)󠁿

 int Plural form.

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

    ```php
    public function get_plural_form( int $number ): int {
    	if ( ! $this->parsed ) {
    		$this->parse_file();
    	}

    	if ( null === $this->plural_forms && isset( $this->headers['plural-forms'] ) ) {
    		$expression         = $this->get_plural_expression_from_header( $this->headers['plural-forms'] );
    		$this->plural_forms = $this->make_plural_form_function( $expression );
    	}

    	if ( is_callable( $this->plural_forms ) ) {
    		/**
    		 * Plural form.
    		 *
    		 * @var int $result Plural form.
    		 */
    		$result = call_user_func( $this->plural_forms, $number );

    		return $result;
    	}

    	// Default plural form matches English, only "One" is considered singular.
    	return ( 1 === $number ? 0 : 1 );
    }
    ```

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

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

| Uses | Description | 
| [WP_Translation_File::parse_file()](https://developer.wordpress.org/reference/classes/wp_translation_file/parse_file/)`wp-includes/l10n/class-wp-translation-file.php` |

Parses the file.

  | 
| [WP_Translation_File::get_plural_expression_from_header()](https://developer.wordpress.org/reference/classes/wp_translation_file/get_plural_expression_from_header/)`wp-includes/l10n/class-wp-translation-file.php` |

Returns the plural forms expression as a tuple.

  | 
| [WP_Translation_File::make_plural_form_function()](https://developer.wordpress.org/reference/classes/wp_translation_file/make_plural_form_function/)`wp-includes/l10n/class-wp-translation-file.php` |

Makes a function, which will return the right translation index, according to the plural forms header.

  |

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

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

## User Contributed Notes

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