WordPress.org

Make WordPress Core

Opened 13 months ago

Last modified 13 months ago

#45159 new defect (bug)

Embed template not loaded with certain custom post types

Reported by: pampfelimetten Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9.8
Component: Embeds Keywords:
Focuses: Cc:
PR Number:

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 (2)

#1 @pampfelimetten
13 months 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).

Version 0, edited 13 months ago by pampfelimetten (next)
Note: See TracTickets for help on using tickets.