Hide invisible posts in public caches

This commit is contained in:
Tetrakern 2023-08-17 16:13:12 +02:00
parent 39a9f5ce10
commit 5deeb29991
8 changed files with 108 additions and 6 deletions

View File

@ -302,7 +302,7 @@ Fictioneer customizes WordPress by using as many standard action and filter hook
| `user_has_cap` | `fictioneer_edit_only_comments`
| `wp_list_comments_args` | `fictioneer_comment_list_args`
| `wp_handle_upload_prefilter` | `fictioneer_upload_restrictions`
| `wp_insert_post_data` | `fictioneer_remove_restricted_block_content`, `fictioneer_strip_shortcodes_on_save`
| `wp_insert_post_data` | `fictioneer_remove_restricted_block_content`, `fictioneer_strip_shortcodes_on_save`, `fictioneer_see_some_evil`
| `wp_is_application_passwords_available` | `__return_false`
| `wp_robots` | `fictioneer_add_noindex_to_robots`
| `wp_sitemaps_enabled` | `__return_false`

View File

@ -25,6 +25,17 @@ if ( ! empty( $is_hidden ) ) {
get_header( null, $header_args );
// Draft or private (if caching is on)?
$post_status = get_post_status( $post_id );
if (
fictioneer_caching_active() &&
$post_status !== 'publish' &&
( $_GET['preview'] ?? 0 ) !== 'true'
) {
fictioneer_redirect_to_404();
}
?>
<div class="progress">

View File

@ -15,7 +15,23 @@
*/
?>
<?php get_header(); ?>
<?php
// Header
get_header( null, array( 'type' => 'fcn_collection' ) );
// Draft or private (if caching is on)?
$post_status = get_post_status( $post_id );
if (
fictioneer_caching_active() &&
$post_status !== 'publish' &&
( $_GET['preview'] ?? 0 ) !== 'true'
) {
fictioneer_redirect_to_404();
}
?>
<main id="main" class="main collection">
<div class="observer main-observer"></div>

View File

@ -11,7 +11,23 @@
*/
?>
<?php get_header( null, array( 'type' => 'fcn_recommendation' ) ); ?>
<?php
// Header
get_header( null, array( 'type' => 'fcn_recommendation' ) );
// Draft or private (if caching is on)?
$post_status = get_post_status( $post_id );
if (
fictioneer_caching_active() &&
$post_status !== 'publish' &&
( $_GET['preview'] ?? 0 ) !== 'true'
) {
fictioneer_redirect_to_404();
}
?>
<main id="main" class="main recommendation">
<div class="observer main-observer"></div>

View File

@ -26,6 +26,17 @@ if ( ! empty( $is_hidden ) ) {
get_header( null, $header_args );
// Draft or private (if caching is on)?
$post_status = get_post_status( $post_id );
if (
fictioneer_caching_active() &&
$post_status !== 'publish' &&
( $_GET['preview'] ?? 0 ) !== 'true'
) {
fictioneer_redirect_to_404();
}
?>
<main id="main" class="main story">

View File

@ -8,7 +8,23 @@
*/
?>
<?php get_header(); ?>
<?php
// Header
get_header();
// Draft or private (if caching is on)?
$post_status = get_post_status( $post_id );
if (
fictioneer_caching_active() &&
$post_status !== 'publish' &&
( $_GET['preview'] ?? 0 ) !== 'true'
) {
fictioneer_redirect_to_404();
}
?>
<main id="main" class="main post">
<div class="observer main-observer"></div>

View File

@ -9,7 +9,23 @@
*/
?>
<?php get_header(); ?>
<?php
// Header
get_header();
// Draft or private (if caching is on)?
$post_status = get_post_status( $post_id );
if (
fictioneer_caching_active() &&
$post_status !== 'publish' &&
( $_GET['preview'] ?? 0 ) !== 'true'
) {
fictioneer_redirect_to_404();
}
?>
<main id="main" class="main singular">
<div class="observer main-observer"></div>

View File

@ -9,7 +9,23 @@
*/
?>
<?php get_header(); ?>
<?php
// Header
get_header();
// Draft or private (if caching is on)?
$post_status = get_post_status( $post_id );
if (
fictioneer_caching_active() &&
$post_status !== 'publish' &&
( $_GET['preview'] ?? 0 ) !== 'true'
) {
fictioneer_redirect_to_404();
}
?>
<main id="main" class="main singular">
<div class="observer main-observer"></div>