Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



wp_find_hierarchy_loop ›

Seit3.1.0
Veraltetn/v
wp_find_hierarchy_loop ( $callback, $start, $start_parent, $callback_args = array() )
Zugriff:
  • private
Parameter: (4)
  • (callable) $callback Function that accepts ( ID, $callback_args ) and outputs parent_ID.
    Erforderlich: Ja
  • (int) $start The ID to start the loop check at.
    Erforderlich: Ja
  • (int) $start_parent The parent_ID of $start to use instead of calling $callback( $start ). Use null to always use $callback
    Erforderlich: Ja
  • (array) $callback_args Optional. Additional arguments to send to $callback.
    Erforderlich: Nein
    Standard: array()
Gibt zurück:
  • (array) IDs of all members of loop.
Definiert in:
Codex:

Find hierarchy loops using a callback function that maps object IDs to parent IDs.



Quellcode

function wp_find_hierarchy_loop( $callback, $start, $start_parent, $callback_args = array() ) {
	$override = is_null( $start_parent ) ? array() : array( $start => $start_parent );

	if ( ! $arbitrary_loop_member = wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override, $callback_args ) ) {
		return array();
	}

	return wp_find_hierarchy_loop_tortoise_hare( $callback, $arbitrary_loop_member, $override, $callback_args, true );
}