-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Link to homeUrl from site editor view menu. #45475
Conversation
Open in CodeSandbox Web Editor | VS Code | VS Code Insiders |
const { | ||
getUnstableBase, // Site index. | ||
} = select( coreStore ); | ||
|
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.
This is a 100% copy-paste from packages/block-library/src/home-link/edit.js
-- let me know if there is a better way. I am sure there is.
Size Change: +15 B (0%) Total Size: 1.28 MB
ℹ️ View Unchanged
|
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.
Thank you, @peterwilsoncc!
The fix works as expected 👍
blockEditorMode: __unstableGetEditorMode(), | ||
homeUrl: getUnstableBase()?.home, |
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.
This is much better. We were only using the URL setting, so there was no need to return the whole object.
@peterwilsoncc, the #45476 solved the issue for the Site Logo block. We still need to resolve this for the "View" URL. |
What?
Replaces the siteURL link in the full site editor view menu with the homeUrl.
Why?
siteUrl is a reference to the WordPress install, ie the folder containing wp-cron.php, wp-mail.php, etc. homeUrl is the home page of the website. On sites with WordPress installed in a sub-directory, the two values can differ.
How?
I've added
@wordpress/core-data
as a dependency of the site editor header and used that to locate the homeUrl. I suspect it could be added equally well the the existing settings but I was unsure how to go about that.Fixes #45474.
Testing Instructions
This should open the site's home page rather than the sub-directory containing the install/
Screenshots or screencast