Created
July 2, 2020 12:00
-
-
Save kimcoleman/5490c6b751cc4e7c60018ea69b3d84b8 to your computer and use it in GitHub Desktop.
Only show the discount code fields if a code is passed in via URL paramter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Only show the discount code fields if a code is passed in via URL paramter | |
* | |
* 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 hide_my_pmpro_show_discount_code( $show ) { | |
if ( empty( $_REQUEST[ 'discount_code' ] ) ) { | |
$show = false; | |
} | |
return $show; | |
} | |
add_filter( 'pmpro_show_discount_code', 'hide_my_pmpro_show_discount_code'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This recipe is included in the blog post on "Hide the Discount Code Fields" at Paid Memberships Pro here: https://www.paidmembershipspro.com/hide-the-discount-code-fields/