For Developers: Admin Hook Reference
↑ Back to topThis document covers all admin-specific hooks in WooCommerce Memberships. You can also view the document on frontend-specific hooks.
WooCommerce Memberships is extremely extensible and offers ample actions and filters for developers to customize it as needed. If a hook doesn’t exist where you think it should, please submit a ticket so we can consider its addition.
This hook reference includes some of the actions and filters developers may find useful while customizing the plugin, but is not an exhaustive reference of all plugin hooks. Inline docs include parameters and returned values for more detail — the appropriate file for each hook is listed so you can refer to it.
Please note that this document is a developer reference provided as a courtesy, as our support policy does not include customizations.
This reference lists helpful filters / actions and is meant to be a directory. Please see the plugin’s inline documentation for additional details on parameters, returned values, and usage.
Filters: Membership Access
↑ Back to topwc_memberships_access_granting_purchased_product_id
- @since
- 1.0.0
- @param
- int $product_id the ID that’s used for access
- @param
- array $access_granting_product_ids Array of product IDs that can grant access to this plan
- @param
- \WC_Memberships_Membership_Plan $plan Membership plan access will be granted to
- @return
- int – the new product ID to use
wc_memberships_grant_access_from_new_purchase
- @since
- 1.3.5
- @param
- bool $grant_access true by default
- @param
- array $args {
- @type int|string $user_id user ID for order
- @type int|string $product_id product ID that grants access
- @type int|string $order_id order ID }
Examples:
- Disable granting access if the customer already holds any membership
- Disable granting access if the customer already holds an active membership
wc_memberships_plan_grants_access_while_subscription_active
- @since
- 1.6.0
- @param
- bool $grants_access Default: true
- @param
- int $plan_id Membership Plan ID
wc_memberships_grant_access_from_existing_purchase_order_statuses
- @since
- 1.0.0
- @param
- array $valid_order_statuses_for_grant array of order statuses
- @param
- object $plan the associated membership plan object
- @return
- array – the updated array of status
wc_memberships_allow_cumulative_member_discounts
- @since
- 1.7.0
- @param
- bool $cumulative true if discounts should stack across plans
- @param
- int $member_id ID for the member / WP user
- @param
- \WC_Product $product
add_filter( 'wc_memberships_allow_cumulative_member_discounts', '__return_false' );
Filters: Membership Statuses
↑ Back to topwc_memberships_user_membership_statuses
- @since
- 1.0.0
- @param
- array $statuses Associative array of statuses
- @return
- array – updated status array
wc_memberships_active_access_membership_statuses
- @since
- 1.7.0
- @param
- array $statuses array of statuses valid for content access
wc_memberships_valid_membership_statuses_for_cancel
- @since
- 1.0.0
- @param
- array $statuses Array of statuses valid for cancellation
- @return
- array – updated array of statuses
wc_memberships_valid_membership_statuses_for_renewal
- @since
- 1.0.0
- @param
- array $statuses Array of statuses valid for renewal
- @return
- array – updated array of statuses
wc_memberships_bulk_edit_user_memberships_status_options
- @since
- 1.0.0
- @param
- array $statuses Array of bulk-edit statuses available
- @return
- array – updated array of statuses
Filters: Settings
↑ Back to topwc_memberships_general_settings
- @since
- 1.0.0
- @param
- array $settings Array of the plugin settings
- @return
- array – updated settings array
wc_memberships_products_settings
- @since
- 1.0.0
- @param
- array $settings Array of the plugin settings
- @return
- array – updated settings array
Filters: Excluded from Restriction
↑ Back to topwc_memberships_content_restriction_excluded_post_types
- @since
- 1.0.0
- @param
- array $post_types List of post types to exclude
- @return
- array – the updated array of post types
wc_memberships_{$rule_type}_excluded_taxonomies
- @since
- 1.0.0
- @param
- array $taxonomies List of taxonomies to exclude
- @return
- array – updated taxonomy list
content_restriction
, product_restriction
, or purchasing_discount
.
Filters: Meta Boxes
↑ Back to topwc_memberships_product_data_tabs
- @since
- 1.0.0
- @param
- array $tabs Associative array of memberships data tabs
- @return
- array – updated tab array
wc_membership_plan_data_tabs
- @since
- 1.0.0
- @param
- array $tabs Associative array of membership plan tabs
- @return
- array – updated tab array
Actions: General
↑ Back to topwc_memberships_activated
Runs when Memberships is activated.wc_memberships_deactivated
Runs when Memberships is deactivated.wc_memberships_duplicate_membership_plan
- @since
- 1.0.0
- @param
- int $new_id New plan ID
- @param
- \WP_Post $post Original plan object
Actions: Edit User Memberships
↑ Back to topwc_memberships_before_user_membership_notes
- @since
- 1.0.0
- @param
- WC_Memberships_User_Membership $user_membership The user membership
wc_memberships_after_user_membership_notes
- @since
- 1.0.0
- @param
- \WC_Memberships_User_Membership $user_membership The user membership
wc_memberships_before_user_membership_member_details
- @since
- 1.0.0
- @param
- int $user_id The member (user) ID
- @param
- int $user_membership_id The post id of the user membership post
wc_memberships_after_user_membership_member_details
- @since
- 1.0.0
- @param
- int $user_id The member (user) ID
- @param
- int $user_membership_id The post id of the user membership post
wc_memberships_before_user_membership_details
- @since
- 1.0.0
- @param
- \WC_Memberships_User_Membership $user_membership The user membership
wc_memberships_after_user_membership_details
- @since
- 1.0.0
- @param
- \WC_Memberships_User_Membership $user_membership The user membership
wc_memberships_before_user_membership_billing_details
- @since
- 1.0.0
- @param
- \WC_Memberships_User_Membership $user_membership The user membership
wc_memberships_after_user_membership_billing_details
- @since
- 1.0.0
- @param
- \WC_Memberships_User_Membership $user_membership The user membership
wc_memberships_user_membership_actions_start
- @since
- 1.0.0
- @param
- int $post_id The post id of the wc_user_membership post
wc_memberships_user_membership_actions_end
- @since
- 1.0.0
- @param
- int $post_id The post id of the wc_user_membership post
Actions: Restriction Meta Boxes
↑ Back to topAll restriction meta box actions are located in: /includes/admin/meta-boxes/class-wc-memberships-meta-box-product-memberships-data.php
wc_memberships_data_product_write_panel_tabs
Fires after the product memberships data write panel tabs are displayed.wc_memberships_data_options_restrict_product
Fires after the product memberships data product restriction panel is displayed.wc_memberships_data_options_grant_access
Fires after the product memberships data grant access panel is displayed.wc_memberships_data_options_purchasing_discounts
Fires after the membership plan purchasing discounts panel is displayed.wc_memberships_data_product_panels
Fires after the product memberships data panels are displayed.Actions: Edit Membership Plan
↑ Back to topAll membership plan page actions are located in: /includes/admin/meta-boxes/class-wc-memberships-meta-box-membership-plan-data.php
wc_membership_plan_write_panel_tabs
Fires after the membership plan write panel tabs are displayed.wc_membership_plan_options_membership_plan_data_general
Fires after the membership plan general data panel is displayed.wc_membership_plan_options_membership_plan_data_restrict_content
Fires after the membership plan content restriction panel is displayed.wc_membership_plan_options_membership_plan_data_restrict_products
Fires after the membership plan product restriction panel is displayed.wc_membership_plan_options_membership_plan_data_purchasing_discounts
Fires after the membership plan purchasing discounts panel is displayed.wc_membership_plan_options_membership_plan_members_area
Fires after the membership plan members area panel is displayed.wc_membership_plan_data_panels
Fires after the membership plan data panels are displayed.Actions: Membership Lifecycle
↑ Back to topwc_memberships_grant_membership_access_from_purchase
- @since
- 1.0.0
- @param
- \WC_Memberships_Membership_Plan $membership_plan The plan that user was granted access to
- @param
- array $args {
- @type int|string $user_id user ID for order
- @type int|string $product_id product ID that grants access
- @type int|string $order_id order ID
- @type int|string $user_membership_id post ID for the new user membership }
wc_memberships_user_membership_saved
- @since
- 1.3.8
- @param
- /WC_Memberships_Membership_Plan $membership_plan The plan that user was granted access to
- @param
- array $args {
- @type int|string $user_id user ID for the membership
- @type int|string $user_membership_id post ID for the new user membership
- @type bool $is_update true if the membership is being updated, false if new }
wc_memberships_user_membership_created
- @since
- 1.3.8
- @param
- /WC_Memberships_Membership_Plan $membership_plan The plan that user was granted access to
- @param
- array $args {
- @type int|string $user_id user ID for the membership
- @type int|string $user_membership_id post ID for the new user membership
- @type bool $is_update true if the membership is being updated, false if new }
wc_memberships_user_membership_saved
, but won’t fire when memberships are manually created from admin.
wc_memberships_cancelled_user_membership
- @since
- 1.0.0
- @param
- int $user_membership_id
wc_memberships_user_membership_status_changed
- @since
- 1.0.0
- @param
- WC_Memberships_User_Membership $user_membership
- @param
- string $old_status Old status, without the wcm- prefix
- @param
- string $new_status New status, without the wcm- prefix
wc_memberships_new_user_membership_note
- @since
- 1.0.0
- @param
- array $data {
- @type int|string $user_membership_id post ID for the new user membership
- @type object $note the user membership note (comment object) added
- @type bool $notify true if the member will be notified }