Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dwanjuki/7a3ef1cce3decf41dfad9ecc71e7625d to your computer and use it in GitHub Desktop.
Save dwanjuki/7a3ef1cce3decf41dfad9ecc71e7625d to your computer and use it in GitHub Desktop.
Makes "Filter Everything" frontend filters work for non-admins too if PMPro User Pages is active
<?php // copy from below
/**
* Remove PMPro User Pages query filter if the query is a Filter Everything query
*
* 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_flrt_query_remove_pmproup_filter( $query ) {
if( $query->get( 'flrt_query_clone' ) ) {
remove_filter( 'pre_get_posts', 'pmproup_pre_get_posts' );
}
return $query;
}
add_filter( 'pre_get_posts', 'my_flrt_query_remove_pmproup_filter' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment