Created
June 27, 2024 12:06
-
-
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
This file contains 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 // 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