_wp_object_name_sort_cb()
Serves as a callback for comparing objects based on name.
Used with uasort().
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
Int
. Negative number if $a->name is less than $b->name, zero if they are equal, or greater than zero if $a->name is greater than $b->name.
Usage
_wp_object_name_sort_cb( $a, $b );
- $a(object) (required)
- The first object to compare.
- $b(object) (required)
- The second object to compare.
Changelog
Since 3.1.0 | Introduced. |
_wp_object_name_sort_cb() wp object name sort cb code WP 6.1.1
function _wp_object_name_sort_cb( $a, $b ) { return strnatcasecmp( $a->name, $b->name ); }