wp_find_hierarchy_loop_tortoise_hare Wordpress function


Uses the "The Tortoise and the Hare" algorithm to detect loops.



(callback) $callback function that accepts ( ID, callback_arg, ... ) and outputs parent_ID
(int) $start The ID to start the loop check at
(array) $override an array of ( ID => parent_ID, ... ) to use instead of $callback
(array) $callback_args optional additional arguments to send to $callback
(bool) $_return_loop Return loop members or just detect presence of loop? Only set to true if you already know the given $start is part of a loop (otherwise the returned array might include branches)

Return Type:

(mixed) scalar ID of some arbitrary member of the loop, or array of IDs of all members of loop if $_return_loop

Define At:


Wordpress Reference URL:


0 Flares Facebook 0 Google+ 0 0 Flares ×
Posted in: Wordpress functions
0 Flares Facebook 0 Pin It Share 0 Google+ 0 0 Flares ×