Contents

Plugins / hook()

Description

Use this function to hook (attach) your plugin's function(s) to anchors (actions, filters) in the core code (or other plugins).

Usage

<?php 
	hook( $anchor, $function, $params, $order ); 
?>

Parameters

$anchor

  • required
  • string

The name of the anchor you would like to hook into.

$function

  • required
  • string

The name of your function.

$params

  • optional
  • array

An array of parameters you would like to send to your function. Example:

<?php 
	hook( "anchor", "my_func", array( $param1, $param2 ) ); 
	function my_func( $param1, $param2 ) 
	{ 
		echo $param1; 
		echo $param2; 
	} 
?>


$order

  • optional
  • integer
  • default: -1 (load order)

This option lets you decide when your plugin function should be called, relative to the other hooks in the specific anchor. This is useful if you need to force your function to perform its' task before or after others.

Related