feat(republish): option to preserve original date - #549
Open
faisalahammad wants to merge 1 commit into
Open
faisalahammad wants to merge 1 commit into
faisalahammad wants to merge 1 commit into
Conversation
Scheduled Rewrite & Republish copies the copy's future post_date onto the original post, which bumps the original to the top of the post feed. Adds a "Preserve the original publication date" checkbox to the Duplicate Post options, defaulting to off. When enabled, the date fields are left out of the post array passed to wp_update_post(), so the original keeps its publish date while the modified date is refreshed like a normal post update. Immediate republishing is unchanged. Adds unit and integration tests for both option states. Fixes Yoast#403
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
duplicate_post_preserve_date_on_scheduled_republishoption is disabled by default, so existing behavior is unchanged unless users opt in.republish_post_elements()unsetspost_date,post_date_gmt,post_modifiedandpost_modified_gmton the post object passed towp_update_post(). Core keeps the original publish date from the database and regenerates the modified timestamps on update.republish_scheduled_post(), so the immediate Republish flow is not affected.nullby the Settings API. The option is read with an(int)cast, sonullreads as disabled.Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
wp cron event run --due-nowwith WP-CLI, or by running the pending future post event with the WP Crontrol plugin.Relevant test scenarios
Test instructions for QA when the code is in the RC
QA can test this PR by following these steps:
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
Post_Republisher. Cloning, the immediate Republish flow and normal post saving are not touched. The plugin hooks intofuture_to_publish, so a quick check that scheduling a normal (non Rewrite & Republish) future post still works as usual is advisable.UI changes
Documentation
Quality assurance
Innovation
innovationlabel and noted the work hours.Fixes #403