Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

_wp_object_name_sort_cb() WordPress Function

The _wp_object_name_sort_cb() function is used to sort objects by their name attribute. This function is used by the Wordpress core when sorting posts, terms, and comments.

_wp_object_name_sort_cb( object $a, object $b ) #

Serves as a callback for comparing objects based on name.


Description

Used with uasort().


Top ↑

Parameters

$a

(object)(Required)The first object to compare.

$b

(object)(Required)The second object to compare.


Top ↑

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.


Top ↑

Source

File: wp-includes/category-template.php

function _wp_object_name_sort_cb( $a, $b ) {
	return strnatcasecmp( $a->name, $b->name );
}

Top ↑

Changelog

Changelog
VersionDescription
3.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.