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

MERL-1270: Do not rewrite links in the post editor #1625

Merged
merged 8 commits into from
Nov 15, 2023
2 changes: 2 additions & 0 deletions plugins/faustwp/includes/replacement/callbacks.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,11 @@ function post_preview_link( $link, $post ) {
* @return string URL used for the post.
*/
Copy link
Member

@theodesp theodesp Nov 2, 2023

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.

Without the above filter:
Screenshot 2023-11-02 at 17 08 47

With the above filter:
Screenshot 2023-11-02 at 17 07 49

Unless there is a better way... @josephfusco any hints?

function post_link( $link ) {
global $pagenow;
if (
! is_rewrites_enabled()
|| ( function_exists( 'is_graphql_request' ) && is_graphql_request() )
|| ( in_array( $pagenow, array( 'index.php', 'edit.php', 'post.php', 'post-new.php', 'upload.php', 'media-new.php' ), true ) && current_user_can( 'edit_posts' ) && defined( 'REST_REQUEST' ) && REST_REQUEST )
mindctrl marked this conversation as resolved.
Show resolved Hide resolved
) {
return $link;
}
Expand Down
Loading