[wp-trac] [WordPress Trac] #56698: Define 'Word count type' as a WP_Locale property
WordPress Trac
noreply at wordpress.org
Tue Feb 7 20:47:53 UTC 2023
#56698: Define 'Word count type' as a WP_Locale property
-------------------------------------------------+-------------------------
Reporter: pedromendonca | Owner: audrasjb
Type: enhancement | Status: reopened
Priority: normal | Milestone: 6.2
Component: I18N | Version: 4.3
Severity: normal | Resolution:
Keywords: has-patch needs-testing-info needs- | Focuses:
testing has-unit-tests commit |
-------------------------------------------------+-------------------------
Changes (by kraftbj):
* status: closed => reopened
* resolution: fixed =>
Comment:
I have a case where `wp_trim_words` being used in a mu-plugin before
`$wp_locale` is set.
`wp_trim_words` is calling `wp_get_word_count_type` and then directly
calling on `$wp_locale->get_word_count_type`.
Would there be any objection to a patch that does something like this:
{{{
function wp_get_word_count_type() {
global $wp_locale;
if ( ! ( $wp_locale instanceof WP_Locale ) ) {
// Default value of get_word_count_type.
return 'words';
}
return $wp_locale->get_word_count_type();
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56698#comment:18>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list