Skip to content
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

Add Rewrite & Republish hooks #301

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

mphillips
Copy link

Context

This PR adds the same dp_duplicate_post and dp_duplicate_page actions when a post is duplicated for Rewrite & Republish that are fired when when a post is cloned. Without these hooks, we can't hook into the Rewrite & Republish process the way we can with the other copy processes.

Summary

This PR can be summarized in the following changelog entry:

  • Added hooks when a post is duplicated for Rewrite & Republish to align with the hooks already present when a post is just copied.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Create a duplicate of a post for Rewrite & Republish
  • If the post type is hierarchical or in the Pages post type, verify the dp_duplicate_page hook is fired and includes the duplicate post's ID, the WP_Post object representing the original post, and the status of the new post.
  • If the post type is not hierarchical or in the Pages post type, verify the dp_duplicate_post hook is fired and includes the duplicate post's ID, the WP_Post object representing the original post, and the status of the new post.
  • Verify the duplicate_rewrite_and_republish_post_copy hook is fired and includes the duplicate post's ID, the WP_Post object representing the original post, and the status of the new post.

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/post types
  • Changes should be tested on different editors (Block/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

  • Since this PR adds the dp_duplicate_post and dp_duplicate_page actions to the Rewrite & Republish process, verify the setting to copy children works since it relies on those actions.
  • Also need to verify the dp_duplicate_page and dp_duplicate_post hooks aren't fired multiple times when duplicating a post for Rewrite & Republish

UI changes

  • This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

Documentation

  • I have written documentation for this change.

Quality assurance

  • I have tested this code to the best of my abilities
  • I have added unittests to verify the code works as intended

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label and noted the work hours.

Fixes #

@YourMark
Copy link

This PR would be a very welcome addition. When using repost and rewrite and republish I need to update the post ID to the new post in the database.

This would be extremely helpful for that :-) Thanks @mphillips

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants