Different permalink structure for custom post type? (2 posts)

  1. plinth
    Posted 5 years ago #

    I have a custom post type called 'portfolio'. Within this there is a meta box/custom field labelled 'subtitle'. At the moment any post added to this custom type is displaying with the following permalink structure: http://www.example.com/portfolio/portfolio-title/

    What I'd like to do is this: http://www.example.com/portfolio/portfolio-title/subtitle/

    I've toyed with a custom field permalinks plugin, but as it's a meta box within a custom post type it doesn't seem to be picking it up. Is this possible?

  2. David Gard
    Posted 5 years ago #

    For this you would need to change the Wordpresws rewrite rules. These are stored in an array in your database and can be viewed by adding the following line to the top of your index.php file -

    <?php echo '<pre>'.$wp_rewrite.'</pre>'; ?>

    However, any changes to this would be overwritten everytime you resave your permalink structure (unless you use some kind of filter in your functions.php file, but not sure if one exists). Other than that, you would be looking at adding some code to the .htaccess file (but even that is over-written on a permalink save I think).

Topic Closed

This topic has been closed to new replies.

About this Topic