Skip to content

Instantly share code, notes, and snippets.

@ronalfy
Created September 13, 2020 20:15
Show Gist options
  • Save ronalfy/f72894632afffa2505a1a74458b050e8 to your computer and use it in GitHub Desktop.
Save ronalfy/f72894632afffa2505a1a74458b050e8 to your computer and use it in GitHub Desktop.
Paid Memberships Pro - REST API Exclude
<?php
/**
* Show full content when using REST.
*
* 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 pmpro_remove_content_filter() {
remove_filter( 'the_content', 'pmpro_membership_content_filter', 5 );
remove_filter( 'the_excerpt', 'pmpro_membership_excerpt_filter', 15 );
remove_filter( 'get_the_excerpt', 'pmpro_membership_get_excerpt_filter_start', 1 );
remove_filter( 'get_the_excerpt', 'pmpro_membership_get_excerpt_filter_end', 100 );
}
add_action( 'rest_api_init', 'pmpro_remove_content_filter' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment