Skip to content

Instantly share code, notes, and snippets.

View sc0ttkclark's full-sized avatar
🍕
Working hard reviewing and deploying code

Scott Kingsley Clark sc0ttkclark

🍕
Working hard reviewing and deploying code
View GitHub Profile
@sc0ttkclark
sc0ttkclark / my-pmpro-wpgraphql-private-posts.php
Last active November 7, 2021 03:59
Integrate with WPGraphQL to check if the current user has access to certain post types.
<?php
/**
* Integrate with WPGraphQL to check if the current user has access to certain post types.
*
* 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/
*/
@sc0ttkclark
sc0ttkclark / my-pmpro-invite-code-max-usage-1
Created October 28, 2021 18:29
For the Invite Only Add On, set the maximum times a code can be used to only once.
<?php
/**
* For the Invite Only Add On, set the maximum times a code can be used to only once.
*
* 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/
*/
@sc0ttkclark
sc0ttkclark / .htaccess
Last active October 24, 2021 00:54
Handle .php files using the getfile in PMPro integration.
# Add this to your .htaccess code just like the normal getfile.php code.
# Follow instructions here first and then add the line: https://www.paidmembershipspro.com/locking-down-protecting-files-with-pmpro/
RewriteRule ^protected-directory/(.*)$ /wp-content/plugins/paid-memberships-pro/services/getfile.php [L]
@sc0ttkclark
sc0ttkclark / do-not-run-shortcodes-for-code-tags.php
Created September 21, 2021 01:54
Do not run shortcodes for code/pre tags.
<?php
/**
* Do not run shortcodes for code/pre tags (at p7) before running the shortcodes (p8).
*
* @param string $post_content The post content.
*
* @return string The filtered post content.
*/
function do_not_run_shortcodes_for_code_tags( $post_content ) {
@sc0ttkclark
sc0ttkclark / my-pmpro-redirect-to-referring-page-after-checkout.md
Last active June 6, 2022 12:44 — forked from ipokkel/my-pmpro-redirect-to-referring-page-after-checkout.php
Redirect new members and existing members that changes their existing level back to the referring page after checkout.

Some users reported the recipe not redirecting to the referer after checkout.

Updated the my_pmpro_redirect_to_referring_page_after_checkout_track function that sets the cookie here: ipokkel/32d6ba9425d4550a5861709498e00135

@sc0ttkclark
sc0ttkclark / pmpro-disable-email-html-cleanup.php
Last active January 31, 2022 18:07
This recipe will disable the HTML removal from email templates when using unsupported tags.
<?php // do not copy this line.
/**
* This recipe will disable the HTML removal from email templates when using unsupported tags.
*
* 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/
*/
@sc0ttkclark
sc0ttkclark / pods-hide-taxonomy-meta-box-for-taxonomy.php
Created August 31, 2021 13:37
Pods Snippet -- Set the taxonomy meta box callback to false so it will hide the meta box on associated post types.
<?php
// pods_register_taxonomy_{YOUR_TAXONOMY_NAME_HERE}
add_filter( 'pods_register_taxonomy_my_custom_tax', 'my_pods_taxonomy_hide_meta_box' );
/**
* Set the taxonomy meta box callback to false so it will hide the meta box on associated post types.
*
* @param array $options The list of taxonomy options for register_taxonomy().
*
* @return array The list of taxonomy options for register_taxonomy().
@sc0ttkclark
sc0ttkclark / pmpro-mmpu-fix-email-confirmations.php
Created August 27, 2021 01:25
Fix confirmation emails so they go out as expected for the Multiple Memberships Per User Add On
<?php // do not copy this line.
/**
* This recipe will help fix confirmation emails so they go out as expected for the Multiple Memberships Per User 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/
*/
@sc0ttkclark
sc0ttkclark / pmpro-mailpoet-redirect-fix.php
Created August 26, 2021 18:48
Allow requests from MailPoet on the frontend and prevent them from improperly redirecting to the Membership Dashboard page.
<?php // do not copy this line.
/**
* This recipe will allow requests from MailPoet on the frontend and prevent them from improperly redirecting to the Membership Dashboard 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/
*/
@sc0ttkclark
sc0ttkclark / givewp-multisite-cookie.php
Last active September 26, 2021 18:22
Maybe set the GiveWP cookie needed for the Donor Dashboard on Multisite subsites (when GiveWP is not network activated)