On this page
_c( string $text, string $domain = 'default' ): string
This function has been deprecated. Use _x() instead.
Retrieve translated string with vertical bar context
Description
Quite a few times, there will be collisions with similar translatable text found in more than two places but with different translated context.
In order to use the separate contexts, the _c() function is used and the translatable string uses a pipe (‘|’) which has the context the string is in.
When the translated string is returned, it is everything before the pipe, not including the pipe character. If there is no pipe in the translated text then everything is returned.
See also
Parameters
$textstring Required-
Text to translate.
$domainstring Optional-
Domain to retrieve the translated text.
Default:
'default'
Return
string Translated context string without pipe.
Source
File: wp-includes/deprecated.php. View all references
function _c( $text, $domain = 'default' ) {
_deprecated_function( __FUNCTION__, '2.9.0', '_x()' );
return before_last_bar( translate( $text, $domain ) );
}
Related
Uses
| Uses | Description |
|---|---|
| before_last_bar() wp-includes/l10n.php | Removes last item on a pipe-delimited string. |
| translate() wp-includes/l10n.php | Retrieves the translation of $text. |
| _deprecated_function() wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
Changelog
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/_c