Open islamafify opened 1 year ago
hooks/class-aal-hook-posts.php
public function hooks_transition_post_status( $new_status, $old_status, $post ) { if ( 'auto-draft' === $old_status && ( 'auto-draft' !== $new_status && 'inherit' !== $new_status ) ) { // The page has been created. $action = 'created'; } elseif ( 'auto-draft' === $new_status || ( 'new' === $old_status && 'inherit' === $new_status ) ) { // Ignore... skip. return; } elseif ( 'trash' === $new_status ) { // The page has been deleted. $action = 'trashed'; } elseif ( 'trash' === $old_status ) { // The page has been restored. $action = 'restored'; } elseif ( 'future' === $new_status ) { // The page has been scheduled for future publishing. $action = 'scheduled'; } elseif ( 'draft' === $new_status ) { // The draft has been saved. $action = 'drafted'; } elseif ( 'pending' === $new_status ) { // The post is pending review. $action = 'pending_review'; } elseif ( 'private' === $new_status ) { // The post has been set to private. $action = 'private'; } else { // Other unspecified status. $action = 'unknown_status'; }
But I still have a problem, which is if the post is scheduled and someone clicks on the update button without changing anything, the schedule event will appear and I want it to show an update
hooks/class-aal-hook-posts.php
public function hooks_transition_post_status( $new_status, $old_status, $post ) { if ( 'auto-draft' === $old_status && ( 'auto-draft' !== $new_status && 'inherit' !== $new_status ) ) { // The page has been created. $action = 'created'; } elseif ( 'auto-draft' === $new_status || ( 'new' === $old_status && 'inherit' === $new_status ) ) { // Ignore... skip. return; } elseif ( 'trash' === $new_status ) { // The page has been deleted. $action = 'trashed'; } elseif ( 'trash' === $old_status ) { // The page has been restored. $action = 'restored'; } elseif ( 'future' === $new_status ) { // The page has been scheduled for future publishing. $action = 'scheduled'; } elseif ( 'draft' === $new_status ) { // The draft has been saved. $action = 'drafted'; } elseif ( 'pending' === $new_status ) { // The post is pending review. $action = 'pending_review'; } elseif ( 'private' === $new_status ) { // The post has been set to private. $action = 'private'; } else { // Other unspecified status. $action = 'unknown_status'; }