In Admin, is there any way to use a slug instead of a post ID# within the URL that takes you to a post’s edit screen.

So instead of:

http://example.com/wp-admin/post.php?post=5562&action=edit

You would use something like:

http://example.com/wp-admin/post.php?slug=home&action=edit

Or, since the database stores the slug in the column post-name:

http://example.com/wp-admin/post.php?post-name=home&action=edit

Of course, neither of these actually works. Is there some existing method for doing this using WordPress’ built-in URL parameters?

If not, what sort of function could be used in my theme’s functions.php file that would make this work?

1 Answer
1

If the home page is set as “Home” in settings, use:

get_edit_post_link( get_option( 'page_on_front' ) );

Leave a Reply

Your email address will not be published. Required fields are marked *