Title: gettext_{$domain}
Published: August 11, 2020
Last modified: May 20, 2026

---

# apply_filters( “gettext_{$domain}”, string $translation, string $text, string $domain )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/gettext_domain/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/hooks/gettext_domain/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/gettext_domain/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/gettext_domain/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/gettext_domain/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/gettext_domain/?output_format=md#user-contributed-notes)

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

Filters text with its translation for a domain.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/gettext_domain/?output_format=md#description)󠁿

The dynamic portion of the hook name, `$domain`, refers to the text domain.

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

 `$translation`string

Translated text.

`$text`string

Text to translate.

`$domain`string

Text domain. Unique identifier for retrieving translated strings.

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

    ```php
    $translation = apply_filters( "gettext_{$domain}", $translation, $text, $domain );
    ```

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

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

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

Retrieves the translation of $text.

  |

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

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

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/gettext_domain/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 3 content](https://developer.wordpress.org/reference/hooks/gettext_domain/?output_format=md#comment-content-6602)
 2.    [MIFTA WIDAYA](https://profiles.wordpress.org/miftawidaya/)  [  3 years ago  ](https://developer.wordpress.org/reference/hooks/gettext_domain/#comment-6602)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fgettext_domain%2F%23comment-6602)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fgettext_domain%2F%23comment-6602)
 4.  **Changing Texts in Plugins using the gettext_domain Filter**
 5.  Sometimes, when working with WordPress plugins, you might want to customize the
     displayed texts to better match your website’s content or branding. The `gettext_domain`
     filter provides a simple way to achieve this by allowing you to modify specific
     text strings used by a plugin.
 6.  Here’s a practical example of how to use the `gettext_domain` filter to change
     text strings in the context of the WP Document Revisions plugin:
 7.  Suppose you’re using the WP Document Revisions plugin and want to replace the 
     term “Owner” with “Submitter” in various instances throughout your site.
 8.  You can achieve this by adding the following code snippet to your theme’s `functions.
     php` file or a custom plugin:
 9.      ```php
         add_filter( 'gettext_wp-document-revisions', 'wpdocs_change_wp_document_revision_strings', 10, 3 );
         /**
          * Code snippet to change the "Owner" text in the WP Document Revisions plugin
          *
          * @link https://developer.wordpress.org/reference/hooks/gettext_domain/
          */
         function wpdocs_change_wp_document_revision_strings( $translated_text, $text, $domain ) {
             if ( 'wp-document-revisions' === $domain ) {
                 switch ( $text ) {
                     case 'Owner':
                         $translated_text = 'Submitter';
                         break;
                     case 'All owners':
                         $translated_text = 'All submitters';
                         break;
                     case 'Document Owner':
                         $translated_text = 'Submitted by';
                         break;
     
                     // Add more cases for other strings you want to change
     
                 }
             }
     
             return $translated_text;
         }
         ```
     
 10.  * The dynamic portion of the hook ensures that the filter only applies to the
        specified domain, so the `'wp-document-revisions' === $domain` check is redundant.
      * [crstauf](https://profiles.wordpress.org/crstauf/) [3 years ago](https://developer.wordpress.org/reference/hooks/gettext_domain/#comment-6605)
 11.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fgettext_domain%2F%3Freplytocom%3D6602%23feedback-editor-6602)
 12.  [Skip to note 4 content](https://developer.wordpress.org/reference/hooks/gettext_domain/?output_format=md#comment-content-7387)
 13.   [HelgaTheViking](https://profiles.wordpress.org/helgatheviking/)  [  9 months ago  ](https://developer.wordpress.org/reference/hooks/gettext_domain/#comment-7387)
 14. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fgettext_domain%2F%23comment-7387)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fgettext_domain%2F%23comment-7387)
 15. Per @crstauf’s feedback, the code snippet should be simplified to:
 16.     ```php
         add_filter( 'gettext_wp-document-revisions', 'wpdocs_change_wp_document_revision_strings', 10, 3 );
         /**
          * Code snippet to change the "Owner" text in the WP Document Revisions plugin
          *
          * @link https://developer.wordpress.org/reference/hooks/gettext_domain/
          */
         function wpdocs_change_wp_document_revision_strings( $translated_text, $text, $domain ) {
             switch ( $text ) {
                 case 'Owner':
                     $translated_text = 'Submitter';
                     break;
                 case 'All owners':
                     $translated_text = 'All submitters';
                     break;
                 case 'Document Owner':
                     $translated_text = 'Submitted by';
                     break;
     
                 // Add more cases for other strings you want to change.
     
             }
     
             return $translated_text;
         }
         ```
     
 17.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fgettext_domain%2F%3Freplytocom%3D7387%23feedback-editor-7387)

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