Skip to content

Commit

Permalink
Short-circuit edac_save_post() when post_status is trash
Browse files Browse the repository at this point in the history
  • Loading branch information
pattonwebz committed Mar 15, 2024
1 parent 9c8cd68 commit be8416b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion includes/validate.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ function edac_post_on_load() {
* @param object $post The post object being saved.
* @param bool $update Whether this is an existing post being updated.
*
* @modified 1.10.0 to add a return when post_status is trash.
*
* @return void
*/
function edac_save_post( $post_ID, $post, $update ) {
Expand All @@ -65,6 +67,11 @@ function edac_save_post( $post_ID, $post, $update ) {
return;
}

// Ignore posts in, or going to, trash.
if ( 'trash' === $post->post_status ) {
return;
}

// ignore revisions.
if ( wp_is_post_revision( $post_ID ) ) {
return;
Expand Down Expand Up @@ -200,7 +207,7 @@ function edac_remove_corrected_posts( $post_ID, $type, $pre = 1, $ruleset = 'php
if ( 0 === count( $rule_slugs ) ) {
return;
}

if ( 1 === $pre ) {

// Set record flag before validating content.
Expand Down

0 comments on commit be8416b

Please sign in to comment.