Opened 6 years ago
Last modified 6 months ago
#42733 assigned defect (bug)
WordPress Embed URLs don't work for draft and scheduled posts with pretty permalinks
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | |
Component: | Embeds | Keywords: | needs-patch needs-unit-tests |
Focuses: | Cc: |
Description
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
Change History (6)
Note: See
TracTickets for help on using
tickets.
Yeah it'd be great if
get_post_embed_url()
could get some improvement to make the URLs correct for such posts.