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

Problems when you define a site_url that is different from the home_url #54454

Open
miscs opened this issue Sep 14, 2023 · 4 comments
Open

Problems when you define a site_url that is different from the home_url #54454

miscs opened this issue Sep 14, 2023 · 4 comments
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") Needs Testing Needs further testing to be confirmed. [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. [Type] Bug An existing feature does not function as intended

Comments

@miscs
Copy link

miscs commented Sep 14, 2023

Description

I use WordPress in a headless mode and therefore I define a site_url that is different from the home_url in Settings->General.

home_url: backend.domainA.com
site_url: domainB.com

If have seen #1761 and implemented the mentioned workaround

add_filter('rest_url', function($url) {
    $url = str_replace(home_url(), site_url(), $url);
    return $url;
});

With this filter I can use Gutenberg again (add / edit posts). But when I use a block theme, I see the following call to the site_url, which obviously cannot work:

site_url/?p=10&_wp-find-template=true&_locale=user

Step-by-step reproduction instructions

  1. Go to Settings->General
  2. Define a site_url which is different from home_url
  3. Wonder why this is not supported by Gutenberg and implement the workaround in Gutenberg breaks completely if site URL is not the same as wordpress URL #1761 using the rest_url-filter
  4. Open Gutenberg and check console -> there are errors logged because of a request to site_url/?p=10&_wp-find-template=true&_locale=user

Disclaimer: I want to use a block theme in the backend because of the functionality it provides in wp-admin, even when I am using WordPress in Headless mode with a custom frontend.

Screenshots, screen recording, code snippet

No response

Environment info

  • WordPress 6.3
  • Twenty Twenty-Three
  • No other plugins

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@Mamaduka Mamaduka added Needs Testing Needs further testing to be confirmed. [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") labels Sep 14, 2023
@jordesign jordesign added the [Type] Bug An existing feature does not function as intended label Sep 14, 2023
@github-actions
Copy link

Hi,
This issue has gone 30 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps.
Thanks for helping out.

@github-actions github-actions bot added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Oct 15, 2023
@miscs
Copy link
Author

miscs commented Oct 16, 2023

It is still relevant with latest release.

@github-actions github-actions bot removed the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Oct 17, 2023
Copy link

Hi,
This issue has gone 30 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps.
Thanks for helping out.

@github-actions github-actions bot added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Nov 16, 2023
@dz0ny
Copy link

dz0ny commented Jun 6, 2024

Here is a partial solution.

#57945 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") Needs Testing Needs further testing to be confirmed. [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

4 participants