Instead of serving a 404 Not Found error with the 404.php template,
send a 403 Forbidden error and set $wp_query->is_403 and load
403.php if it exi
| Author: | Weston Ruter (profile at wordpress.org) |
| WordPress version required: | 2.7 |
| WordPress version tested: | 2.8 |
| Plugin version: | 0.2 |
| Added to WordPress repository: | 28-09-2009 |
| Last updated: | 28-09-2009
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
|
| Rating, %: | 0 |
| Rated by: | 0 |
| Plugin URI: | http://wordpress.org/extend/plugins/private-p... |
| Total downloads: | 1 553 |
![]() Click to start download |
|
This plugin is developed at Shepherd Interactive for the benefit of the community. No support is available. Please post any questions to the support forum.
Instead of serving a 404 Not Found error with the 404.php template,
send a 403 Forbidden error and set $wp_query->is_403 and load
403.php if it exists.
Provides a filter forbidden_redirect which if results in a non-empty
filtered value will result in the user being redirected if attempting to visit a
forbidden page; the default value is "" (no redirect).
Useful with a filter which selectively prevents a private post from being forbidden, so that the page will not show up in the navigation and won't be included in XML Sitemaps, for example.
function my_filter_private_posts($posts){
if(is_singular() && $posts[0]->post_status == 'private'
&& #Now optionally allow/disallow based on user session:
in_array($_SERVER['REQUEST_URI'], (array)@$_SESSION['allowed_private_uris']))
){
header('Cache-Control: private'); #Prevent proxies from caching this private page
$posts[0]->post_status = 'publish';
}
return $posts;
}
add_filter('posts_results', 'my_filter_private_posts');ChangeLog
