Skip to content

Commit

Permalink
Fix should revalidate to make sure private posts are revalidated
Browse files Browse the repository at this point in the history
  • Loading branch information
kuuak committed Feb 6, 2024
1 parent bfff523 commit 4373ca0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/Revalidate.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ function should_revalidate( $post_id ) {

$isPubliclyViewable = is_post_publicly_viewable($post_id);
$isAutosave = wp_is_post_autosave($post_id) !== false;
$status = get_post_status( $post_id );

try {
if ( ! $isPubliclyViewable ) {
if ( ! $isPubliclyViewable && !in_array($status, ['publish', 'private']) ) {
// if the post is not publicly viewable, and it's an autosave, we should not revalidate it.
if ( $isAutosave ) throw new Exception("not viewvable", 1);

Expand Down

0 comments on commit 4373ca0

Please sign in to comment.