WordPress.org

Ready to get started?Download WordPress

Forums

custom post type permalinks WP_Rewrite (2 posts)

  1. Sanka
    Member
    Posted 2 years ago #

    Hi,

    I've got 2 custom-post-types:
    - artist
    - album
    Where you can select an artist as parent for an album.

    When creating the above 2 post-types, i used the following for the rewrite-options:
    rewrite => array('slug' => 'artist')
    rewrite => array('slug' => 'albums')

    The artist-permalinks look like this now: /artist/artist_slug/ (for the archive that is /artist/)

    The problem is within the albums. I Want my permalinks to look like:
    /artist/artist_slug/albums/album_slug/ (where /artist/artist_slug/albums/ should be the archive-page for the albums of that specific artist)

    When i don't select a parent for a album, the permalink looks like:
    /albums/album_slug/, but when i select a parent, it becomes:
    /albums/artist_slug/album_slug/, which results in a 404.

    I guess this can't be resolved with the 'rewrite' option of the custom-post-type, so i have to use the WP_Rewrite class. Tho, with the codex alone, i'm not able to create the scenario i describe above.
    Can anyone push me in the right direction, i.e. what steps i should take to get this up and running?
    Thanks in advance!

  2. Sanka
    Member
    Posted 2 years ago #

    Anyone can help me on this? I'm kinda stuck...

Topic Closed

This topic has been closed to new replies.

About this Topic