WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 6 months ago

Last modified 3 months ago

#45159 closed defect (bug) (invalid)

Embed template not loaded with certain custom post types

Reported by: pampfelimetten Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Embeds Keywords:
Focuses: Cc:

Description

We use a handfull of different custom post types. The internal embeding works fine for most, showing the iframe with the abstract, page logo, etc. But with some it doesn't work, it only shows the post title.
The only major difference I found, is, that the falling cpt has the special rewrite setting with_front set to false.
I traced it back, the problem is, that it isn't even calling the embed.php template in the theme directory, it is failing before.

Change History (4)

#1 @pampfelimetten
2 years ago

Update: I'm pretty sure meanwhile it has something to do with the custom rewrite rules we use for this custom post type.
We have 2 posttypes called "zeitungsausgabe" and "zeitungsartikel".
The rewrite of "zeitungsartikel is basically "zeitung/%zeitungsausgabe%/%zeitungsartikel%", which we resolve by setting custom add_rewrite_tag called "z" and adding custom rewrite rules and filter the post_type_link to account for it.
It seems like the function url_to_postid doesn't account for custom rewrite tags, as it resolves the url to

"zeitung//%zeitungsartikel%"


  • the custom rewrite tag is ignored. thereby it cannot properly resolve the url (but weirdly somehow still gets the title).
Last edited 2 years ago by pampfelimetten (previous) (diff)

#3 @pampfelimetten
6 months ago

  • Resolution set to invalid
  • Status changed from new to closed

Yep, it was an bug in my code =|

#4 @desrosj
3 months ago

  • Milestone Awaiting Review deleted
  • Version 4.9.8 deleted
Note: See TracTickets for help on using tickets.