Skip to content

Instantly share code, notes, and snippets.

View dwanjuki's full-sized avatar

David Wanjuki dwanjuki

  • Nairobi, Kenya
  • 18:08 (UTC +03:00)
View GitHub Profile
@dwanjuki
dwanjuki / my_pmpro_downloads_show_in_searches_and_archives.php
Created July 21, 2026 10:29
Keep PMPro downloads visible in searches/archives/library even when "Filter Searches and Archives" is set to Yes.
<?php
/**
* Keep PMPro downloads visible in searches/archives/library
* even when "Filter Searches and Archives" is set to Yes.
*
* The files remain protected.
*
* 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.
@dwanjuki
dwanjuki / adjust-pmpro-subscription-delay.php
Last active July 17, 2026 10:23 — forked from andrewlimaza/adjust-pmpro-subscription-delay.php
Adjust Subscription Delay based on signup date
<?php
/**
* Set the subscription profile_start_date to the 1st of a month.
*
* New signups: roughly one year from checkout, snapped to the 1st.
* Renewals extended by the Auto-Renewal Checkbox Add On: keep the extended
* start date it calculated, snapped to the 1st.
*
* NOTE: This is for yearly membership levels.
*/
<?php
/**
* Charge the level's billing amount instead of the initial payment when an old (expired or cancelled)
* member checks out again for the same level within a set number of years of their membership ending.
*
* 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 / include-level-in-members-list-export-filename.php
Created July 9, 2026 09:22
Include the membership level name in the Members List CSV export filename.
<?php
/**
* Include the membership level name in the Members List CSV export filename.
*
* Retains the export ID in the name so the filename is unique.
*
* 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_plus_icon_in_title.php
Last active July 3, 2026 13:57
Add custom content before title of posts with protected content
<?php
/**
* Add custom content before title of posts with protected content
*
* 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 / charge-billing-amount-on-renewal.php
Created July 2, 2026 11:33
Charge the level's Billing Amount instead of the Initial Payment when an existing member checks out to manually renew their current level.
<?php
/**
* Charge the level's Billing Amount instead of the Initial Payment when an
* existing member checks out to manually renew their current level.
*
* Only applies to members who have been continuously active on that level
* for at least the number of months set in MY_PMPRO_RENEWAL_ACTIVE_MONTHS below.
*
* 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.
<?php
/**
* This recipe requires members to apply and be approved for the "application" level
* again before rejoining a "main" level after their main membership has ended.
*
* For this recipe to work, you must be using the Approvals Add On and your main
* levels must be set to "Yes. User must have an approved membership for a different
* level." or "Yes. User must have an approved membership for a different level AND
* admin must approve new members for this level." under the Approval Settings when
* editing the membership level. Other approval and non-approval levels will not
@dwanjuki
dwanjuki / apply-tax-for-ALL-UK-customers.php
Created June 30, 2026 08:28
VAT Tax Add On: Apply tax for ALL UK customers
<?php
/**
* Apply tax for ALL UK customers
*
* Requires VAT Tax Add On
*
* 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
/**
* This ensures that the UK can be selected from the dropdown to add Tax to the
* membership but will not validate the VAT number.
*
* 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
/**
* Require Approval for Every Signup (with admin notification)
*
* Forces every checkout for an approval-required level back to "pending",
* so a previously-approved member (e.g. one whose membership expired) must
* be manually re-approved before regaining access.
*
* It also makes sure the admin "pending approval" email is sent for those
* returning members.