-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Backport: Navigation Post Edit Link #4657
Backport: Navigation Post Edit Link #4657
Conversation
Co-authored-by: Jonny Harris <spacedmonkey@users.noreply.github.com>
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.
Thanks @getdave
The code looks good.
I was just wondering, is the back link used anywhere?
Looking at WordPress/gutenberg#39286 I couldn't work out whether we need this change at all.
Or is for revisions.php?
@@ -1474,6 +1474,8 @@ function get_edit_post_link( $post = 0, $context = 'display' ) { | |||
if ( 'wp_template' === $post->post_type || 'wp_template_part' === $post->post_type ) { | |||
$slug = urlencode( get_stylesheet() . '//' . $post->post_name ); | |||
$link = admin_url( sprintf( $post_type_object->_edit_link, $post->post_type, $slug ) ); | |||
} elseif ( 'wp_navigation' === $post->post_type ) { |
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.
I think we could add an annotation in the get_edit_post_link()
PHP doc, e.g., something like
* @since 6.3.0 Adds custom link for wp_navigation post types.
@ramonjd It was on the revisions page "Back to Editor" button. |
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.
Thanks for getting this PR up @getdave
_edit_link
needs to be one level up in the register_post_type()
args array
Also it'd be great to add a test
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.
LGTM
Closing in favour of #4710 |
Backports changes that amend the Post Edit link for wp_navigation posts from WordPress/gutenberg#39286 to Core.
Trac ticket: https://core.trac.wordpress.org/ticket/58589
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.