WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i create a new post-type in wordpress. The new post-type is called work.

I want to customize the link when the user click "details button". The link is work/post_id/postname

I have a trouble to connect the link to a details page. The details page is called single-work.php In my functions.php I write these rules:

add_action( 'init', 'wpse26388_rewrites_init' );
    function wpse26388_rewrites_init(){
    add_rewrite_rule( "work/([0-9]+)/([0-9]+)?$", "single-work.php", 'top' );

But there is a trouble because when the user click the link, he sees the index.php and not single-work.php. How can I fix that?

share|improve this question

You don't need a URL rewrite. WP will show the single work post by default using the single-work.php template.

Go to Settings > Permalinks and select Custom Structure there. Put this rule in the text input:


And save the settings.

This should work for you.

share|improve this answer
I setting this rules but when i click the link i see a index.php and not single-work.php .There are some thing that i customize? for exaples a .htaccess file or a option when i register my post-type? – andrea poma Sep 20 '12 at 9:35
Your htaccess might not be writable... – Rutwick Gangurde Sep 20 '12 at 10:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.