-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove not necessary publish_post action. #587
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -41,7 +41,6 @@ public static function get_instance() { | |||
* Instantiate the object. | ||||
*/ | ||||
function __construct() { | ||||
add_action( 'publish_post', array( $this, 'handle_modified' ) ); | ||||
add_action( 'publish_page', array( $this, 'handle_modified' ) ); | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Similar to publish_post, we don't need publish_page either, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no save_page here. Maybe we should swap it with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The only reason we'd need both publish_page and save_post is if somebody was manually calling wp_transition_post_status. |
||||
add_action( 'save_post', array( $this, 'handle_modified' ) ); | ||||
add_action( 'delete_post', array( $this, 'handle_delete' ) ); | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per https://github.com/WordPress/WordPress/blob/f08039702ecdfeaba850c91bc0e3008272104509/wp-includes/post.php#L4892 both actions will run one after the other one in case of a save_post.