Requests_Hooks::register() WordPress Method

The Requests_Hooks::register() method allows you to register a callback for a specific hook on a request. This is useful for modifying the request before it is sent, or for doing something afterwards with the response.

Requests_Hooks::register( string $hook, callback $callback, int $priority ) #

Register a callback for a hook


Parameters

$hook

(string)(Required)Hook name

$callback

(callback)(Required)Function/method to call on event

$priority

(int)(Required)Priority number. <0 is executed earlier, >0 is executed later


Top ↑

Source

File: wp-includes/Requests/Hooks.php

	public function register($hook, $callback, $priority = 0) {
		if (!isset($this->hooks[$hook])) {
			$this->hooks[$hook] = array();
		}
		if (!isset($this->hooks[$hook][$priority])) {
			$this->hooks[$hook][$priority] = array();
		}

		$this->hooks[$hook][$priority][] = $callback;
	}

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.