[wp-trac] [WordPress Trac] #34565: Warning after change theme
WordPress Trac
noreply at wordpress.org
Wed Nov 4 10:20:27 UTC 2015
#34565: Warning after change theme
-----------------------------------+------------------------------
Reporter: sebastian.pisula | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Themes | Version: 3.4
Severity: normal | Resolution:
Keywords: has-patch 2nd-opinion | Focuses:
-----------------------------------+------------------------------
Comment (by bobbingwide):
Just like to point out that when the locale is not 'en_' with 83 themes,
WP_Theme::_name_sort_i18n is called 890 times. Time 0.047 secs.
It would be more efficient to pre-translate the Name field before calling
uasort()
{{{
foreach ( $themes as $key => $theme ) {
$theme->display( "Name", false, true );
}
}}}
and replace the business logic in _name_sort_i18n() with
{{{
return strnatcasecmp( $a->name_translated, $b->name_translated );
}}}
The sort function is still called the same number of times, but it is
slightly quicker.
BTW. I was unable to get the Warning message without resorting to using
print_r() in the sort function.
Would like to know more details how to produce the message. Using PHP
5.5.18
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34565#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list