wp_get_word_count_type()WP 6.2.0

Retrieves the word count type based on the locale.

No Hooks.

Return

String. Locale-specific word count type. Possible values are characters_excluding_spaces, characters_including_spaces, or words.

Usage

wp_get_word_count_type();

Notes

  • Global. WP_Locale. $wp_locale WordPress date and time locale object.

Changelog

Since 6.2.0 Introduced.

wp_get_word_count_type() code WP 6.7.2

function wp_get_word_count_type() {
	global $wp_locale;

	if ( ! ( $wp_locale instanceof WP_Locale ) ) {
		// Default value of WP_Locale::get_word_count_type().
		return 'words';
	}

	return $wp_locale->get_word_count_type();
}