Opened 21 months ago
Closed 21 months ago
#58746 closed task (blessed) (fixed)
Toolbar: Make the 'Edit site' link aware of the current template
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.3 | Priority: | normal |
Severity: | normal | Version: | 5.9 |
Component: | Toolbar | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
Original Gutenberg issue: https://github.com/WordPress/gutenberg/issues/37850.
Update the 'Edit site" link in the toolbar and make it aware of the current template.
Why?
Often when I use the "Edit site" link in the WordPress admin bar, it is because I want to edit the current template.
This can be a post/page or an archive (they should all work the same).
Instead, the link opens the index/home/front-page, and I have to find a way to navigate to the template I wanted to edit.
Attachments (1)
Change History (11)
This ticket was mentioned in PR #4810 on WordPress/wordpress-develop by @Mamaduka.
21 months ago
#1
- Keywords has-patch added
#2
@
21 months ago
Test Report
This report validates that the indicated patch addresses the issue.
Patch tested: PR #4810
Environment
- OS: macOS 13.4.1
- Web Server: nginx/1.23.1
- PHP: 7.4.29
- WordPress: 6.3-beta3-56130-src
- Browser: Chrome Version 114.0.5735.198
- Theme: Twenty Twenty-three, twenty twenty-two, Twenty Ten (classic)
- Active Plugins:
- I tested with and without WooCommerce, as this is the only plugin I know of that adds custom block theme templates.
Actual Results
- ✅ Works as expected with patch.
#3
@
21 months ago
- Milestone changed from Awaiting Review to 6.3
- Type changed from enhancement to task (blessed)
I am tentatively marking it as a "blessed" task targeting WP 6.3. The Gutenberg issue is in the 6.3 milestone.
@
21 months ago
Site Editor shall know from which ID it got invoked and select template type and content sample accordingly
#4
@
21 months ago
This looks like something we can handle in 6.3.
The PR looks good to me, however I left a comment concerning two needed docblock changes.
@Mamaduka commented on PR #4810:
21 months ago
#5
Thank you, @audrasjb! I added DocBlocks in 447fba8.
#9
@
21 months ago
I tested the current patch, and it works as expected.
TL;DR:
Thinking to commit, along with this additional documentation added to each function that is changed, so that it's clearer what the new global is used for:
@since 6.3.0 Added `$_wp_current_template_id` global for editing of current template directly from the admin bar.
Some further feedback:
I think the user experience of opening an editor that almost, but not quite the same contents was unexpected, but that it's much improved from the current behavior of opening Home every time.
To explain a little more (all with the patch applied):
When "Edit Site" is clicked from the Home/index, a lot of the site's contents are present on the Home template in the editor, and it feels like "my site".
If I click "Edit Site" from a page / post, at least on my theme, I am brought to the current template, but it does not reflect the contents of the page I was on.
I think this is intentional / expected, but I figured I'd note my experience here so that if we want to improve on it later, it's here!
PR makes the 'Edit site' link in the toolbar contextually aware of the current template.
## How
Introduces a new global
$_wp_current_template_id
that stores the current template ID during the template resolution.We can't use the existing
$_wp_current_template_content
global as it only stores template contents.## Refs
Gutenberg issue: https://github.com/WordPress/gutenberg/issues/37850