WordPress at a glance
function is not described

_c() WP 2.2.0

Deprecated from version 2.9.0. It is no longer supported and can be removed in future releases. Use _x() instead.

Retrieve translated string with vertical bar context

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.

This is an internal function for using it by WP core itself. It's not recommended to use this function in your code.

No Hooks.

Return

String. Translated context string without pipe.

Usage

_c( $text, $domain );
$text(string) (required)
Text to translate.
$domain(string)
Domain to retrieve the translated text.

Notes

  • See: _x()

Changelog

Since 2.2.0 Introduced.
Deprecated Since 2.9.0 Use _x()

Code of _c() WP 5.7

<?php
function _c( $text, $domain = 'default' ) {
	_deprecated_function( __FUNCTION__, '2.9.0', '_x()' );
	return before_last_bar( translate( $text, $domain ) );
}