0

I have created a custom post type named bollywood, and a rewrite rule in order to map a URL such as example.com/bollywood/old-movies-of-hero1-with-hero2 to the query index.php?post_type=bollywood&hero1=hero1&hero2=hero2:

add_rewrite_rule( 
  '^bollywood/old-movies-of-([^/]+)-to-([^/]+)/?$',
  'index.php?post_type=bollywood&hero1=$matches[1]&hero2=$matches[2]',
  'top'
);

Currently, single bollywood posts are available at a permalink like domain/bollywood/hero1 - how can I present them at domain/bollywood/old-movies-of-hero1 instead?

2
  • This doesn't answer your question but it seems like your post type should be hero and bollywood should be an entry in a new taxonomy. Hero1, Hero2, etc would be individual posts under your hero post type. Bollywood, Hollywood, Nollywood (yes), Chinese, etc would be entries under a location taxonomy.
    – jdm2112
    Jun 15 at 14:36
  • what ever the post type or post should be the main question is when we write single post it shows like as domain/slug/old-movies-of-post1(any post name) and when two it will be domain/slug/old-movies-of-post1-with-post2 it works for 2 post as mentioned I want for for single url like this domain/slug/old-movies-of-post1(any post name) Jun 16 at 5:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.