rewrite rules – How to make a post accessible from multiple post type slugs?

Question

I have two custom post types

  1. colors
  2. shapes

I have a post called “red” under the custom post type “colors”. The default URL for this post would be

example.com/colors/red

Now I want to make it accessible from the following URL as well

example.com/shapes/red

The closest I came with is to add a filter to change_404_template (as I receive a 404 for above url) and forcefully inject the single.php file with some hacky code.

Is there a way more standard method to do this ?

0
Enlord 3 months 2022-05-21T13:59:24-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse