[wp-trac] [WordPress Trac] #41014: Add `permalink_structure` to REST API settings endpoint

WordPress Trac noreply at wordpress.org
Mon Jun 12 18:07:54 UTC 2017


#41014: Add `permalink_structure` to REST API settings endpoint
-------------------------+-----------------------------
 Reporter:  aduth        |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  REST API     |    Version:  trunk
 Severity:  normal       |   Keywords:
  Focuses:  rest-api     |
-------------------------+-----------------------------
 Related: #38490

 It is not currently possible to view or edit the `permalink_structure`
 option from the REST API. 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.

 See: https://github.com/WordPress/WordPress/blob/9fb2e79/wp-
 admin/includes/post.php#L1323-L1324

 This is relevant for the Gutenberg post editor reimplementation, where
 effort is blocked by unavailability of this setting from the REST API:

 https://github.com/WordPress/gutenberg/pull/1042

 A workaround may be to include the option in a server-rendered initialized
 (localized) JavaScript object, but (a) this is not available to clients
 which may intend to recreate this experience totally separated from the
 WordPress PHP environment and (b) is inconsistent with the expectation
 that settings should be manageable from the REST API (given the presence
 of the settings endpoint).

 Caveats:

 - There is validation that is meant to occur in `sanitize_option` that
 tests whether the incoming `permalink_structure` includes a "structure
 tag". This feels like something that should be baked into the settings
 endpoint behavior (calling `sanitize_option`), and isn't entirely relevant
 to the changes proposed here.
 - Other `permalink` settings (`category_base`, `tag_base`) may be useful
 to include, but aren't part of the changes proposed here. I'm not sure the
 criteria with which settings are decided to be included on this endpoint.
 To me, it seems anything manageable through the Settings section of the
 admin dashboard should also be surfaced through these endpoints.

 https://github.com/WordPress/WordPress/blob/9fb2e79/wp-
 includes/formatting.php#L4030-L4294

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


More information about the wp-trac mailing list