[wp-trac] [WordPress Trac] #42465: Add `permalink_structure` to REST API general site data

WordPress Trac noreply at wordpress.org
Tue Nov 7 22:04:45 UTC 2017

#42465: Add `permalink_structure` to REST API general site data
 Reporter:  schlessera   |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  REST API     |    Version:
 Severity:  normal       |   Keywords:
  Focuses:  rest-api     |
 Related: #41014 , #38731

 As already stated in the above ticket, it is not currently possible to
 view or edit the `permalink_structure` option from the REST API, and this
 makes it difficult to reimplement a post editor leveraging the REST API
 because the "slug" field is only applicable for sites configured to
 include `%postname%` in this option's value.

 One current use case of this is the Permalink setting in the Gutenberg
 editing screen: https://github.com/WordPress/gutenberg/issues/1285

 Previous discussions in the above related tickets concluded that the best
 way forward is to add required general site information to the `wp-json`

 Although the idea was to discuss a list of values that would be sensible
 to add because they might be needed, I think it would be more pragmatic to
 add values as specific use cases pop up. Otherwise, we might end up
 discussing a potential list for months, and still end up with useless as
 well as missing values.

 The current code allows for two different ways to add the

 1. Add it directly to the `$available` array in
 2. Add it through the `'rest_index'` filter, which could just as well be
 done in the Gutenberg code instead.

 In this specific case, I'd argue that `permalink_structure` is useful for
 any client-side code that deals with permalinks, so it might be best to
 have it generally be available, even outside of the Gutenberg project.

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

More information about the wp-trac mailing list