-
Notifications
You must be signed in to change notification settings - Fork 134
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
MERL-1270: Do not rewrite links in the post editor #1625
Conversation
When Faust’s “Enable Post and Category URL rewrites” is enabled, this has been causing URLs to be rewritten in the editor to contain the front-end URL instead of the WP URL, which causes them to be saved to the database this way. Instead, we want the WP URL saved to the database.
🦋 Changeset detectedLatest commit: 14d8384 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📦 Next.js Bundle Analysis for @faustwp/getting-started-exampleThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
Confirms links are not rewritten on post-new.php pages when $_POST is empty. Also confirms Ajax requests to generate sample permalinks are not rewritten. These checks prevent the incorrect guid from being written to the database. Confirms `wp-link-ajax` Ajax requests are not rewritten. This is used by the Classic Editor when linking content. chore: update `enable_rewrites` values in tests to be `1` instead of `true`, for consistency.
@@ -200,13 +200,39 @@ function post_preview_link( $link, $post ) { | |||
* @return string URL used for the post. | |||
*/ |
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.
Since we are preventing storing the Headless url in the database I think we need to add the following filter in line 24 for the content_blocks
plugin:
add_filter( 'wpgraphql_content_blocks_resolver_content', __NAMESPACE__ . '\\content_replacement');
This is to ensure that we trigger domain replacement
when resolving the blocks using parse_blocks
.
Unless there is a better way... @josephfusco any hints?
@theodesp @TeresaGobble I just brought this up to date with canary. Can you please take another look? |
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.
Tasks
Description
When Faust’s “Enable Post and Category URL rewrites” is enabled, this has been causing URLs to be rewritten in the editor to contain the front-end URL instead of the WP URL, which causes them to be saved to the database this way.
Related: the
guid
value for the post is also saved with the Faust front-end URL. This should also be saved with the WP domain.Ideally the WP URLs are saved to the database, so that:
Steps to Reproduce
post_content
andguid
instead of the WP URL.Expected Behavior
The WP URL is saved to the database, so that the content is consistent and matches the domain/URL where it actually lives.
Testing
post_content
andguid
.Documentation Changes
Dependant PRs