Actions and Filters in MemberPress

What Are Hooks?

Hooks in WordPress allow you to change or add code without editing core files. They are used extensively throughout WordPress and MemberPress and are very useful for developers.

There are two types of hook: actions and filters.
  • Actions allow you to insert custom code wherever the hook is run
  • Filters allow you to manipulate and return a variable that it passes to filter
This documentation is a list of some of the most useful actions and filters in MemberPress.

Please note, that this is a Developer level documentation. Our support doesn't cover custom development. 
If you need any help with your customization you can contact one of the developers.

Using Hooks

If you want to use a hook to add or manipulate code, you can add your custom code in many ways:

Using action hooks

To execute your own code using action hook, you need to use your custom function like this:

add_action( 'action_name', 'your_function_name' );
function your_function_name() {
    // Your code
}

Using filter hooks

To manipulate the passed variable in filter hook, you need to use your custom function like this:

add_filter( 'filter_name', 'your_function_name' );
function your_function_name( $variable ) {
    // Your code
    return $variable;
}

Keep in mind that with filters, you must return a value.

Overview

Action Hooks

Filter Hooks

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.