• Hello, so I have custom post type called authors. What I just need is that if for example i open page localhost/authors/davinci just open template file. So it can be anything after authors.(localhost/authors/*).

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You should use add_rewrite_rule() to rewrite /authors/davinci/ to index.php?p=123&my_parm=davinci where 123 is changed to your author page’s ID. The template file for this page would contain whatever custom code you have to take the my_parm value and show the results of a query. Of course you can choose any other name for my_parm as long as it’s not one of the default query vars.

    Remember to visit the permalinks setting screen to flush rewrite rules after you add new rewrite rules.

Viewing 1 replies (of 1 total)
  • The topic ‘custom url of cpt’ is closed to new replies.