fix(ui): hide unused permalink field for Rewrite & Republish copies - #547
Open
faisalahammad wants to merge 1 commit into
Open
faisalahammad wants to merge 1 commit into
faisalahammad wants to merge 1 commit into
Conversation
The block editor shows a permalink row when editing a Rewrite & Republish copy, but the URL in that row is never used: on republish, the original slug is always restored. The legacy removeEditorPanel( 'post-link' ) call no longer hides this row in recent WordPress versions, which render it from the permalink fields in the REST edit response. Strip those fields for copies so the row disappears again. Fixes Yoast#437
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
Post_Republisher::republish_post_elements()always restores the original slug. Users worry the post moves to a new URL when they republish.removeEditorPanel( 'post-link' )injs/src/duplicate-post-edit-script.js, but that is a stale identifier. Recent WordPress renders the row from thepermalink_templateandgenerated_slugfields in the REST edit response, and it only shows the row when a permalink template comes back. So the old call does nothing anymore.Summary
This PR can be summarized in the following changelog entry:
Note: I cannot add labels from my fork account, so a maintainer needs to add the
changelog: bugfixlabel.Relevant technical choices:
rest_api_initfor all post types withshow_in_rest, so custom post types are covered too.removeEditorPanel( 'post-link' )call in the JS stays as a harmless fallback for older editors. No JavaScript was changed.Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
Relevant test scenarios
show_in_rest, because the filters are registered per post type.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:
_dp_is_rewrite_republish_copy) change. Normal posts keep their permalink fields, and New Draft duplicates are not affected.UI changes
Documentation
Quality assurance
Innovation
innovationlabel and noted the work hours.Fixes #437