Last active
February 27, 2017 16:16
-
-
Save Bobz-zg/5e73b4cc05f30ddd6a030154563359bd to your computer and use it in GitHub Desktop.
Include password protected products in WooCommerce search results for non-logged in users
This file contains hidden or 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 | |
/** | |
* Place this part of code somewhere in functions.php | |
*/ | |
add_filter( 'posts_where' , function($q) { | |
global $wpdb; | |
$r = "AND ({$wpdb->posts}.post_password = '')"; | |
$q = str_replace($r, '', $q); | |
return $q; | |
}, 1001 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment