Warning: This method has been deprecated. Use wp_list_sort() instead.

WP_Customize_Manager::_cmp_priority() WordPress Method

The WP_Customize_Manager::_cmp_priority() function is used to compare the priorities of two Customizer controls. This function is used internally by the Customizer when sorting controls by priority.

WP_Customize_Manager::_cmp_priority( WP_Customize_Panel|WP_Customize_Section|WP_Customize_Control $a, WP_Customize_Panel|WP_Customize_Section|WP_Customize_Control $b ) #

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


Parameters

$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.


Top ↑

Return

(int)


Top ↑

Source

File: wp-includes/class-wp-customize-manager.php

	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;
		}
	}


Top ↑

Changelog

Changelog
VersionDescription
4.7.0Use wp_list_sort()
3.4.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.

Show More