Skip to content

Instantly share code, notes, and snippets.

View dwanjuki's full-sized avatar

David Wanjuki dwanjuki

  • Nairobi, Kenya
  • 03:04 (UTC +03:00)
View GitHub Profile
@dwanjuki
dwanjuki / my_pmpro_delete_order_update_discount_code_uses.php
Created December 23, 2025 10:10
Update discount code uses, if found, when an order is deleted
<?php
/**
* Update discount code uses when the order is deleted.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_delete_order_update_discount_code( $order_id, $order ) {
@dwanjuki
dwanjuki / my_pmpro_remove_variable_pricing_if_discount_code_applied.php
Created December 22, 2025 11:31
Remove Variable Pricing section at checkout if a valid discount code is passed in via the URL.
<?php
/**
* Remove Variable Pricing section at checkout if a valid discount code is passed
* in via the URL.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
@dwanjuki
dwanjuki / my_pmpro_bcc_membership_recurring_emails.php
Last active December 22, 2025 13:33
BCC the admin on Membership Recurring emails.
<?php
/**
* BCC the admin on Recurring Payment Receipt emails.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_bcc_membership_recurring_emails( $headers, $email ) {
<?php
/**
* This recipe will take preference to discount codes. If a discount code is applied
* and is free, the variable price field will be removed.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
<?php
/**
* Redirect to the PMPro Login page after logout.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function wp_redirect_to_pmpro_login_after_logout() {
@dwanjuki
dwanjuki / my_pmpromd_phone_display_value.php
Created December 15, 2025 12:15
Format phone User Field display value in the member directory.
<?php
/**
* Format phone User Field display value in the member directory.
*
* Replace cell_phone on line 14 with your phone field's field name/meta key if different.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
@dwanjuki
dwanjuki / my_buddypress_directory_and_profiles_redirect.php
Created December 15, 2025 10:24
Redirect BuddyBoss/BuddyPress directory and profile pages to PMPro Member Directory Directory and Profile pages.
<?php
/**
* Redirect BuddyBoss/BuddyPress directory and profile pages to PMPro Member Directory
* Directory and Profile pages.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
@dwanjuki
dwanjuki / my_pmpropp_show_plans_after_pricing_fields.php
Created November 26, 2025 09:40
Show Payment Plans after Membership Information on checkout page.
<?php // copy form below.
/**
* Show Payment Plans after Membership Information on checkout page.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpropp_show_plans_after_pricing_fields() {
<?php // copy form below.
/**
* Change the "Select a Payment Plan" heading for a specific level
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpropp_level_checkout_gettext( $pmpro_level ) {
@dwanjuki
dwanjuki / my_pmpropp_exclude_default_level_price.php
Created November 26, 2025 09:00
Exclude the default level billing price from payment plan radio options at checkout
<?php // copy from below.
/**
* Exclude the default level billing price from payment plans at checkout
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpropp_exclude_default_level_price( $include_level_price, $level_id ) {