Additional menu

Get MemberPress today! Start getting paid for the content you create! Get MemberPress Now

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 hooks: 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 the 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 code using an 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 a 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

Was this article helpful?

Related Articles

computer girl

Get MemberPress today!

Start getting paid for the content you create.