Closed ravewebdev closed 2 years ago
I've been looking into this and there are a few approach in mind.
The link results are from /wp/v2/search
as seen here. So we can change URLs of the search results on Search endpoint. The trade-off is, while we are just editing the URLs of post types results, the official docs discourages modifying responses of core endpoints.
"Links" are saved as normal post content and not some block attributes. We can perform search and replace action on post save.
Create our own URL Input implementation so it will hit our own search endpoint which handles the URLs. This way we won't need to modify wp/v2/search
endpoint. I've been trying to find a way to modify / filter the built-in URL Input but I can't seem to find a way to do so.
References:
When adding a link to text or a block in the Block Editor, links to other site posts/pages use the WP/BE domain instead of the FE domain. This will need to be modified to use the FE domain (similar to how it's done in the View Post permalink domain) so links work properly on the FE. Currently, these links just redirect to the FE homepage instead.