#57709 closed defect (bug) (fixed)
Links to the editor don't work for template and template parts revisions in the revisions screen
| Reported by: | andraganescu | Owned by: | davidbaumwald |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.3 |
| Component: | Revisions | Version: | |
| Severity: | blocker | Keywords: | has-patch dev-reviewed commit |
| Cc: | Focuses: | ui |
Description
In โhttps://github.com/WordPress/gutenberg/pull/45215 the template and template part editors gained a button that links to the revisions screen for the edited template and template part.
The problem is that in the revisions screen there are two links that should link back to the editor which don't work (one with the template name and another one with the text "go to editor").
In the post editor (block editor) going to the revisions screen will set these links to a shape of:
/wp-admin/post.php?post=3594&action=edit
In the template editor going to the revisions screen will set these links to a shape of:
/wp-admin/revision.php?revision=4068&gutenberg=true, which is the URI of the revisions screen itself.
I've put this for 6.2 since it is a blocker for #57704
Change History (27)
#2
@
4 years ago
- Milestone 6.2 โ 6.3
Hi @audrasjb
Iโve looked into this and:
- the links are wrong because template and template part CPTs do not have the internal
_edit_linkset when they get registered - the shape of an
_edit_linkis completely different from that of posts or pages - for examplesite-editor.php?postId=twentytwentythree//header&action=edit&canvas=edit&path=/template-parts/single&postType=wp_template_part get_edit_post_linkneeds some multiple lines to accommodate this
This is hardly justified to rush and has the potential to break WP admin :)
This ticket was mentioned in โPR #4212 on โWordPress/wordpress-develop by โ@andraganescu.
4 years ago
#3
- Keywords has-patch added; needs-patch removed
Trac ticket: https://core.trac.wordpress.org/ticket/57709
โ@ocean90 commented on โPR #4212:
4 years ago
#4
@draganescu You have to use a fork since branches get auto-deleted on each sync.
โ@andraganescu commented on โPR #4212:
4 years ago
#5
Ooops I missed that part! Thank you @ocean90
This ticket was mentioned in โPR #4229 on โWordPress/wordpress-develop by โ@andraganescu.
4 years ago
#6
Trac ticket: https://core.trac.wordpress.org/ticket/57709
Trac ticket:
โ@andraganescu commented on โPR #4229:
4 years ago
#7
Thanks for the review @spacedmonkey I've committed all your suggestions, will check to see how it works now.
โ@andraganescu commented on โPR #4229:
4 years ago
#8
Applied @anton-vlasenko 's feedback as well. @azaozz had some concerns over how we're using slugs initially. In light of #49164 I don't know if this fix should land or some new way of solving the problem with posts existing on disk 1st should be thought of? cc @youknowriad
โ@youknowriad commented on โPR #4229:
4 years ago
#9
Personally, I think a fix like this PR or similar is the way to go. Reverting to using auto-drafts and all for template and template parts is way too impactful and it's not clear how it would solve the initial issues we had with that approach.
โ@andraganescu commented on โPR #4229:
4 years ago
#10
I fixed the failing tests, let me know if there is anything else needed for this patch to land ๐๐ป
#12
@
4 years ago
Test Report
This report validates that the indicated patch addresses the issue.
Patch tested: โhttps://github.com/WordPress/wordpress-develop/pull/4229
Environment
- WordPress: 6.3-alpha-55505-src
- PHP: 8.0.27
- Server: Apache/2.4.55 (Unix) PHP/8.0.27
- Database: mysqli (Server: 5.7.38 / Client: mysqlnd 8.0.27)
- Browser: Safari 16.4 (macOS)
- Theme: Twenty Twenty-Two - WordPress.com 1.2
- MU-Plugins: None activated
- Plugins:
- Gutenberg 15.5.1
Steps to Reproduce
- Enable Gutenberg.
- Go to the Editor, create your own template part.
- Modify your template by adding a paragraph block, then add another paragraph block, and save it multiple times.
- Open the "Template" tab, click on the "X Revisions" link as shown in the screenshot below:
- In the header, click on the links in the header (as shown below):
Expected Results
- โ The links should take you back to the "Edit template" page.
Actual Results
- โ The links don't work. Nothing happens when I click on them.
After applying the patch
- โ The links take you back to the Edit template page.
Additional Notes
- I have only tested the template parts functionality.
โ@ramonopoly commented on โPR #4229:
4 years ago
#13
Thanks for working on this bug. I started without seeing this one.
We could probably add some tests as well.
I have some here: โhttps://github.com/WordPress/wordpress-develop/pull/4326 if you want to pull them across.
#14
@
4 years ago
Might be worth adding tests for get_edit_post_link()
I couldn't find any. I added some to cover the expected functionality over in
โhttps://github.com/WordPress/wordpress-develop/pull/4326 if you want to pull them across.
#15
@
4 years ago
Tested:
- WordPress 6.3-alpha-55505-src
- Gutenberg Version 15.6.0-rc.1
Can confirm the edit links work for template and template parts
Post and page edit links work as before.
โ@andraganescu commented on โPR #4229:
4 years ago
#16
@ramonjd I included the tests you added ๐๐ป , the edit link for the global styles post type and the comment update. I didn;t understand what you asked about context and encoding ampersand.
@anton-vlasenko not sure if these additions require new testing if the tests pass ๐๐ป
โ@andraganescu commented on โPR #4229:
4 years ago
#17
The tests don't pass :)) will check them out.
โ@andraganescu commented on โPR #4229:
4 years ago
#18
Hmm. Still not fixed the new tests. Will loop back on this.
#19
@
4 years ago
- Keywords commit added
@antonvlasenko said:
Thanks for working on this, @draganescu.
The code looks good to me.
Not sure why Trac didn't pick it up :P
#20
@
4 years ago
Adding additional test results as a confidence check re: comment:16 ๐๐ป
Test Report
Patch tested: โhttps://github.com/WordPress/wordpress-develop/pull/4229
Environment
- Hardware: MacBook Pro Apple M1 Pro
- OS: macOS 13.3.1
- Browser: Safari 16.4
- Server: nginx/1.23.4
- PHP: 7.4.33
- WordPress: 6.3-alpha-55505-src
- Theme: twentytwentythree v1.1
- Active Plugins:
- gutenberg v15.6.0-rc.2
Actual Results
- โ The "Go to editor" and template links on revisions page navigate back to the editor screen.
- โ PHPunit tests pass (see comment:18).
Supplemental Artifacts
| Before Patch | After Patch |
|---|---|
|
|
โannezazu commented on โPR #4229:
4 years ago
#21
Where are we at here? It's holding up my ability to test this more broadly in the FSE Outreach Program and, with all of the work on revisions, I want to ensure we get some solid feedback!
โ@andraganescu commented on โPR #4229:
4 years ago
#22
I think it just needs someone to commit it.
โannezazu commented on โPR #4229:
4 years ago
#23
@ironprogrammer could you perhaps help here?
โ@davidbaumwald commented on โPR #4229:
3 years ago
#26
Merged into core in https://core.trac.wordpress.org/changeset/55743.
โ@andraganescu commented on โPR #4229:
3 years ago
#27
Thank you @dream-encode !
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)




Hello @andraganescu, if we want to fix this issue in 6.2, we'll have to get a patch ready in the next few hours, because #57704 is an enhancement and should even be in the milestone anymore (we're one week pas beta 1).