Rewrite for CPT is not fully covered
-
Hello.
I have a post type like this:
add_action( 'init', function () { register_post_type( 'my-cpt', [ 'public' => true, 'has_archive' => true, ] ); } );
Nothing special. But when I call https://foo/de/my-cpt/yadda-entry or https://foo/my-cpt/yadda-entry (without “de”) it ends up in an 404 page. This might be due to the missing rewrite rule. But why is Polylang not creating the according rule?
– The entry is published in any language.
– I flushed the rewrite rules. Nothing changed.
– Put polylang in the beginning of the activated plugin-list and in the end. Nothing changed.Here are the pattern that contain “my-cpt”:
– (de|en|fr|es)/my-cpt/?$
– (de|en|fr|es)/my-cpt/feed/(feed|rdf|rss|rss2|atom)/?$
– (de|en|fr|es)/my-cpt/(feed|rdf|rss|rss2|atom)/?$
– (de|en|fr|es)/my-cpt/page/([0-9]{1,})/?$
– my-cpt/[^/]+/attachment/([^/]+)/?$
– my-cpt/[^/]+/attachment/([^/]+)/trackback/?$
– my-cpt/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$
– my-cpt/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$
– my-cpt/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$
– my-cpt/[^/]+/attachment/([^/]+)/embed/?$
– my-cpt/([^/]+)/embed/?$
– my-cpt/([^/]+)/trackback/?$
– my-cpt/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$
– my-cpt/([^/]+)/(feed|rdf|rss|rss2|atom)/?$
– my-cpt/([^/]+)/page/?([0-9]{1,})/?$
– my-cpt/([^/]+)/comment-page-([0-9]{1,})/?$
– my-cpt/([^/]+)(?:/([0-9]+))?/?$
– my-cpt/[^/]+/([^/]+)/?$
– my-cpt/[^/]+/([^/]+)/trackback/?$
– my-cpt/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$
– my-cpt/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$
– my-cpt/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$
– my-cpt/[^/]+/([^/]+)/embed/?$I think “(de|en|es|fr)/my-cpt/[^/]+/([^/]+)/?$” is the one which would fix my problem. This one matches at last:
– (de|en|fr|es)/(.?.+?)(?:/([0-9]+))?/?$
Quering for nonsense:
– lang=en&pagename=wordpress-plugin%2Feasy-testimonials-2&page=
Hope to hear from you!
- The topic ‘Rewrite for CPT is not fully covered’ is closed to new replies.