Skip to content

Instantly share code, notes, and snippets.

View dwanjuki's full-sized avatar

David Wanjuki dwanjuki

  • Nairobi, Kenya
  • 12:12 (UTC +03:00)
View GitHub Profile
@dwanjuki
dwanjuki / my_pmpromd_show_hide_directory_field_for_specific_levels.php
Created June 3, 2026 11:20
Show "Hide from PMPro Directory?" checkbox for specific membership levels only
<?php
/**
* Show "Hide from PMPro Directory?" checkbox for specific membership levels only.
* By default, the field shows only on the frontend profile page for all members.
*
* 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 / remove-custom-trial-for-members.php
Created June 2, 2026 10:39 — forked from JarrydLong/remove-custom-trial-for-members.php
Remove custom trial for levels for existing and past members Paid Memberships Pro (Trial only used once)
<?php
/**
* Removes custom trial for active and past members.
* Adjust this code accordingly to price your membership level when removing the trial.
* To add this code to your site, please follow this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_remove_custom_trial( $level ) {
if ( is_admin() || ! is_user_logged_in() ) {
return $level;
@dwanjuki
dwanjuki / my_remove_pmpro_avatar_filter.php
Created May 14, 2026 08:57
Remove PMPro 3.7+ native avatar data filter.
<?php
/**
* Remove PMPro 3.7+ native avatar data filter.
*
* 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_remove_pmpro_avatar_filter() {
@dwanjuki
dwanjuki / my_logout_url_shortcode.php
Created April 29, 2026 15:33
Add a shortcode that outputs the WordPress login link.
<?php
/**
* Add a shortcode that outputs the WordPress login link.
*
* 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_logout_url_shortcode() {
@dwanjuki
dwanjuki / my_pmpro_membership_card_get_display_value_contact_name.php
Created April 10, 2026 11:36
Display two field values in a single line on the Membership Card
<?php
/**
* Combine two text field values for display as a single element on the Membership Card.
*
* Use key primary_contact_name in your field elements.
*
* 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 / open_tag_posts_to_all_visitors.php
Created April 9, 2026 09:26
Posts with specified tags will not require membership to view
<?php
/**
* Posts with specified tags will not require membership to view
*
* 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_open_tag_posts_to_all_visitors( $hasaccess, $thepost, $theuser, $post_membership_levels ) {
@dwanjuki
dwanjuki / my_pmpro_email_data_membership_level_cost.php
Last active April 14, 2026 08:44
Add email variable to display the level cost for the checkout level.
<?php
/**
* Add membership_level_cost email variable.
*
* Displays the level cost for the checkout 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/
@dwanjuki
dwanjuki / my_pmpromd_remove_hide_directory_field.php
Created March 30, 2026 09:05
Remove "Hide from PMPro Directory?" checkbox from checkout and member profile edit page
<?php
/**
* Remove "Hide from PMPro Directory?" checkbox from checkout and member profile edit.
*
* 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_pmpromd_remove_hide_directory_field() {
@dwanjuki
dwanjuki / my_pmpromd_hide_fields_member_profile_edit.php
Created March 27, 2026 11:32
Hide Member Directory fields on the frontend Member Profile Edit page
<?php
/**
* Set Member Directory User Fields profile visibility to admin.
*
* 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_pmpromd_hide_fields_member_profile_edit() {
@dwanjuki
dwanjuki / login-redirect-admin-and-users.php
Last active March 27, 2026 09:39 — forked from ipokkel/pmpro-login-redirect-admin-and-users.php
Redirect administrators to the WP Admin Dashboard and other users to the specified page on login.
<?php
/**
* Redirect Administrators to WP Admin,
* redirect all other users to the specified page after login.
*
* Ignores previously set redirects.
*
* 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.