[wp-trac] [WordPress Trac] #42733: WordPress Embed URLs don't work for draft and scheduled posts with pretty permalinks
WordPress Trac
noreply at wordpress.org
Tue Nov 28 16:46:37 UTC 2017
#42733: WordPress Embed URLs don't work for draft and scheduled posts with pretty
permalinks
--------------------------+-----------------------------
Reporter: Frank Klein | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Embeds | Version:
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
This came up during work on #41451. Two tests fail with ''is_embed is
false but is expected to be true'':
- `Tests_Embed_Template::test_oembed_output_draft_post`
- `Tests_Embed_Template::test_oembed_output_scheduled_post`
Without pretty permalinks, the return of `get_post_embed_url()` is
`http://example.org/?p=8&embed=true`. This URL is recognised as an embed
URL when the request is parsed.
But with pretty permalinks enabled, the return is
`http://example.org/?p=8/embed/`. This is not recognised as an embed URL.
The reason for the mixed URL structure seems to be `get_permalink()`. This
function does not return pretty permalinks for draft or future posts, see
https://core.trac.wordpress.org/browser/tags/4.9/src/wp-includes/link-
template.php#L165
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42733>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list