getMyHooks (function)

Last updated: Mon, Apr 17, 2023 10:02 am
Return to Knowledgebase

Purpose

This function retrieves the hooks for the current page or for a specific page passed as a parameter, and groups them by their position.

Location

users/helpers/us_helpers.php

Parameters

# Parameter Data Type Required Description
1 $opts = [] array No an array that can contain a 'page' key, used to retrieve hooks for a specific page

Returns

Data Type Description of Returned Data
array Returns an array containing the hooks grouped by their position. The positions are pre, post, form, body, and bottom.

Further Documentation:

Example usage:

// retrieve all hooks for the current page
$hooks = getMyHooks();

// retrieve all hooks for the 'dashboard' page
$hooks = getMyHooks(['page' => 'dashboard']);

// display the hooks grouped by position
echo '
';
print_r($hooks);
echo '
';