Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ipokkel/e5391a165cabad30e2b8a1bbbdfb54b4 to your computer and use it in GitHub Desktop.
Save ipokkel/e5391a165cabad30e2b8a1bbbdfb54b4 to your computer and use it in GitHub Desktop.
Tell PMPro to filter the content a bit later to work with ProfitBuilder plugin
<?php // do NOT copy this line, copy from below this line
/*
Tell PMPro to filter the_content a bit later.
This will sometimes fix issues where theme or plugin elements (e.g. videos)
are not being filtered by PMPro. Note that this sometimes will cause
some things (e.g. share links) to be filtered that you don't want to be
filtered... and sometimes edits to the theme or a child theme are
required to get the desired effect.
Add the below code to your custom plugin or Code Snippets Plugin by following this guide
https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
/* -- NOTE --
Profit Builder hooks into the_content at priority order 999
in profit_builder_class.php
on line 633 for v1.9.8
and line 1417 for v2.5.9
through applying this filter: add_filter('the_content', array(&$this, 'replace_content'), 999);
To allow administrators to edit content on restricted content without having to belong to a membership level
that has access to that page or post use this recipe instead:
https://gist.github.com/ipokkel/cb6f7ab38270fc5dd23e757e736cdd76
*/
function my_init_change_pmpro_content_filter_priority()
{
remove_filter('the_content', 'pmpro_membership_content_filter', 5);
add_filter('the_content', 'pmpro_membership_content_filter', 1000);
}
add_action('init', 'my_init_change_pmpro_content_filter_priority');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment