mycred_setup_hooks

Codex / mycred/core / Filters / mycred_setup_hooks

Navigation:

  1. Description
  2. Used By
  3. Parameters
  4. Example

Description

This filter allows you to register your own hooks or remove/disable existing hooks.

 

Used By

  • Class: myCRED_Hooks Method: get()

 

Parameters

  • installed (array)
    Associative array of installed hooks.

 

Example

Example 1: Add a custom hook.

<?php
add_filter( 'mycred_setup_hooks', 'add_my_custom_hook' );
function add_my_custom_hook( $installed )
{
	$installed['my_custom_hook'] = array(
		'title'       => __( 'My Custom Hook' ), // Hook title
		'description' => __( 'This is a custom hook' ), // Description (optional)
		'callback'    => array( 'My_Custom_Hook_Class' ) // Class name
	);

	return $installed;
}
?>

Example 2: Remove the “Registration” Hook.

<?php
add_filter( 'mycred_setup_hooks', 'remove_a_hook' );
function remove_a_hook( $installed )
{
	unset( $installed['registration'] );
	return $installed;
}
?>

Last edited June 26, 2016