REST API: Include permalink_template/generated_slug for Posts

In order for clients to present permalink previews, the REST API must share the computed results of get_sample_permalink(). These two values are now exposed as permalink_template and generated_slug for public, viewable post types, but only for context=edit.

Merges [43720] to trunk.

Props danielbachhuber, rahulsprajapati.
Fixes #45017.


git-svn-id: https://develop.svn.wordpress.org/trunk@43980 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jeremy Felt
2018-12-12 02:11:22 +00:00
parent c0e80b028a
commit 894a8e02d2
5 changed files with 113 additions and 4 deletions

View File

@@ -40,7 +40,7 @@ abstract class WP_Test_REST_Controller_Testcase extends WP_Test_REST_TestCase {
abstract public function test_get_item_schema();
public function filter_rest_url_for_leading_slash( $url, $path ) {
if ( is_multisite() ) {
if ( is_multisite() || get_option( 'permalink_structure' ) ) {
return $url;
}