Title: WP_Textdomain_Registry::set_custom_path
Published: November 2, 2022
Last modified: April 28, 2025

---

# WP_Textdomain_Registry::set_custom_path( string $domain, string $path )

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_textdomain_registry/set_custom_path/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/wp_textdomain_registry/set_custom_path/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/classes/wp_textdomain_registry/set_custom_path/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_textdomain_registry/set_custom_path/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_textdomain_registry/set_custom_path/?output_format=md#changelog)

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

Sets the custom path to the plugin’s/theme’s languages directory.

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

Used by [load_plugin_textdomain()](https://developer.wordpress.org/reference/functions/load_plugin_textdomain/)
and [load_theme_textdomain()](https://developer.wordpress.org/reference/functions/load_theme_textdomain/).

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

 `$domain`stringrequired

Text domain.

`$path`stringrequired

Language directory path.

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

    ```php
    public function set_custom_path( $domain, $path ) {
    	// If just-in-time loading was triggered before, reset the entry so it can be tried again.

    	if ( isset( $this->all[ $domain ] ) ) {
    		$this->all[ $domain ] = array_filter( $this->all[ $domain ] );
    	}

    	if ( empty( $this->current[ $domain ] ) ) {
    		unset( $this->current[ $domain ] );
    	}

    	$this->custom_paths[ $domain ] = rtrim( $path, '/' );
    }
    ```

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

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

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

Loads a plugin’s translated strings.

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

Loads the translated strings for a plugin residing in the mu-plugins directory.

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

Loads the theme’s translated strings.

  |

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

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

## User Contributed Notes

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