Make WordPress Core

Opened 2 months ago

Last modified 2 months ago

#60791 new enhancement

Pre-populate slug using URL parameters on new post edit screen.

Reported by: gerardreches's profile gerardreches Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: has-patch
Focuses: Cc:


get_default_post_to_edit() allows to pre-populate post_title, content, and excerpt from $_REQUEST.

This URL will pre-populate the title and the content:


I have an use case where I need to do the same for the post_name:

I have a shortcode that allows me to load content from a custom post type, and it searches by slug (it needs to be this way for UX reasons).

If the post with the provided slug doesn't exist, I register an admin notice alerting that the shortcode is trying to load an unexisting post, and offer a link to create the missing post with the specified slug. I need the slug to be pre-populated with the URL parameter, just as it is possible to do for title, content, and excerpt.

Change History (2)

This ticket was mentioned in PR #6283 on WordPress/wordpress-develop by @Dargus.

2 months ago

  • Keywords has-patch added

Add post_name to the fields that can be pre-populated through URL parameters in get_default_post_to_edit().

Trac ticket:

This ticket was mentioned in Slack in #core by gerardreches. View the logs.

2 months ago

Note: See TracTickets for help on using tickets.