wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes



wp_find_hierarchy_loop › WordPress Function

Depuis3.1.0
Dépréciéen/a
wp_find_hierarchy_loop ( $callback, $start, $start_parent, $callback_args = array() )
Accès:
  • private
Paramètres: (4)
  • (callable) $callback Function that accepts ( ID, $callback_args ) and outputs parent_ID.
    Requis: Oui
  • (int) $start The ID to start the loop check at.
    Requis: Oui
  • (int) $start_parent The parent_ID of $start to use instead of calling $callback( $start ). Use null to always use $callback.
    Requis: Oui
  • (array) $callback_args Optional. Additional arguments to send to $callback. Default empty array.
    Requis: Non
    Défaut: array()
Retourne:
  • (array) IDs of all members of loop.
Défini(e) dans:
Codex:

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



Source

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

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

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