[wp-trac] [WordPress Trac] #60791: Pre-populate slug using URL parameters on new post edit screen.

WordPress Trac noreply at wordpress.org
Sun Mar 17 06:29:23 UTC 2024


#60791: Pre-populate slug using URL parameters on new post edit screen.
-------------------------------+-----------------------------
 Reporter:  gerardreches       |      Owner:  (none)
     Type:  enhancement        |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Posts, Post Types  |    Version:
 Severity:  normal             |   Keywords:
  Focuses:                     |
-------------------------------+-----------------------------
 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:

 /wp-admin/post-new.php?post_type=post&post_title=My+Title&content=aaaa

 I have an use case where I need to do the same for the `post_name`:
 https://wordpress.org/support/topic/set-title-and-slug-of-new-post-using-
 url-parameters/

 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60791>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list