Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].
Okay, so I saw this other thread which looks like he had the same problem, but the solution didn’t seem to work for me https://siteorigin.com/thread/password-protected-pages-display-the-404-page/
Should that solution work? Or is there something else I could try?
Hi Aduo,
To clarify, are you password protecting the page via WordPress or via .htaccess? If it’s the latter, the instructions definitely should have worked – could you show me your .htaccess contents?
If it’s the former, the linked thread is actually unrelated. This sounds like it could be a plugin conflict issue. Can you try disabling all non-SiteOrigin plugins and see if this fixes the issue? You’ll need to clear all your caches after disabling your plugins.
If it does fix the issue, then try re-enabling your plugins one by one until the issue comes back. This procedure will help diagnose which plugin is causing the issue.
Once we know that, we’ll be able to look at what might be causing the conflict and either solve the problem or help you find an alternative plugin.
If you aren’t using a SiteOrigin theme, then you can also try temporarily switching to one of the default WordPress themes to see if the issue is theme related.
Thank you Alex, it was the former. I did as you suggested and found out it wasn’t to do with plugin incompatibility but instead to do with an old code I had inserted in functions.php to prevent all private pages showing up in page search results for people not logged in. For some reason it interferes with showing private SiteOrigin pages. I don’t know if the code can be altered for SO private pages, that would be great but otherwise I will just leave it be and try see if a plugin like the Search Exclude plugin will work.
Many thanks again Alex!
//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’);