WP_Customize_Manager::_cmp_priority()protectedWP 3.4.0

Deprecated from version 4.7.0. It is no longer supported and can be removed in future releases. Use wp_list_sort() instead.

Helper function to compare two objects by priority, ensuring sort stability via instance_number.

Method of the class: WP_Customize_Manager{}

No Hooks.

Return

Int.

Usage

// protected - for code of main (parent) or child class
$result = $this->_cmp_priority( $a, $b );
$a(WP_Customize_Panel|WP_Customize_Section|WP_Customize_Control) (required)
Object A.
$b(WP_Customize_Panel|WP_Customize_Section|WP_Customize_Control) (required)
Object B.

Changelog

Since 3.4.0 Introduced.
Deprecated since 4.7.0 Use wp_list_sort()

WP_Customize_Manager::_cmp_priority() code WP 6.4.3

protected function _cmp_priority( $a, $b ) {
	_deprecated_function( __METHOD__, '4.7.0', 'wp_list_sort' );

	if ( $a->priority === $b->priority ) {
		return $a->instance_number - $b->instance_number;
	} else {
		return $a->priority - $b->priority;
	}
}