Woosidebars and protected posts
-
I’m trying to implement the hiding of password-protected posts in the general blog page and only showing them on certain pages/categories.
I’m trying to use the code here:
https://codex.www.ads-software.com/Using_Password_Protection#Hiding_Password_Protected_Posts
/** * Function to hide protected posts * https://codex.www.ads-software.com/Using_Password_Protection#Hiding_Password_Protected_Posts // Filter to hide protected posts function exclude_protected($where) { global $wpdb; return $where .= " AND {$wpdb->posts}.post_password = '' "; } // Decide where to display them function exclude_protected_action($query) { if( !is_single() && !is_page() && !is_admin() ) { add_filter( 'posts_where', 'exclude_protected' ); } } // Action to queue the filter at the right time add_action('pre_get_posts', 'exclude_protected_action');
But there seems to be some conflict with WooSidebars such that when the plugin is enabled, no protected posts show up anywhere. Any ideas on where the conflict might be?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Woosidebars and protected posts’ is closed to new replies.