• I’ve added a wordpress website into a subdomain, while using the rest api to pull post data into a custom frontend on the @ domain.

    Wordpress: content.example.com
    Actual domain: example.com
    When I finish writing a post, the post-publish panel enters the frame on the right side of the page with a button and copy-paste field that takes you to https://content.example.com/new-post-slug when the post will only be viewable at https://example.com/new-post-slug

    I’ve tried changing the Site Address in Settings > General, but this breaks the post page and won’t let me save drafts or publish the post.

    How can I change only what url is presented in that post-publish panel?

    Searched for the file that generates that panel and can’t find it. Also concerned about WordPress changing any modifications I make to it during updates.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi there,
    If I understand the problem correctly, this seems to be a known issue. The team closed it as there was a work around.

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

    It might not match your use case entirely. Maybe it gets you started on the right track?

    Thread Starter connorontheweb

    (@connorontheweb)

    Hey thanks for the reply!

    The issue I’m facing is in the admin panel, not the rest api response or anything there.

    It’s the panel that slides in from the right side of the page after publishing a post. It displays the (wp) site address followed by the slug of the post just created.

    The site address isn’t where the post will be read, as I’m using the rest api it will be a separate website. It looks like that panel simply grabs the site address from the current wp instance to create that url and I’d like to change that (without changing the Settings > General > Site Address, which breaks the admin panel) so that it displays the official website followed by the slug.

    Hope I’m explaining this clearly, let me know if I could do more.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change wordpress site address in post-publish panel for REST API frontend’ is closed to new replies.