Make WordPress Core

Opened 7 years ago

Last modified 12 months ago

#42733 assigned defect (bug)

WordPress Embed URLs don't work for draft and scheduled posts with pretty permalinks

Reported by: frank-klein's profile Frank Klein Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Embeds Keywords: needs-patch needs-unit-tests
Focuses: Cc:


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 This URL is recognised as an embed URL when the request is parsed.

But with pretty permalinks enabled, the return is 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

Change History (6)

#1 @swissspidy
6 years ago

  • Keywords needs-patch needs-unit-tests added
  • Milestone changed from Awaiting Review to 5.0

Yeah it'd be great if get_post_embed_url() could get some improvement to make the URLs correct for such posts.

#2 @soulseekah
6 years ago

Maybe adding a third parameter to get_permalink - $force_pretty that disregards the post status and outputs pretty? Just a thought.

#3 @johnbillion
6 years ago

  • Milestone changed from 5.0 to 5.1

#4 @pento
5 years ago

  • Milestone changed from 5.1 to Future Release

This ticket needs a patch.

#5 @swissspidy
5 years ago

  • Owner set to swissspidy
  • Status changed from new to assigned

#6 @swissspidy
12 months ago

  • Owner swissspidy deleted
Note: See TracTickets for help on using tickets.