WordPress.org

Forums

custom rewrite rules for custom post type (4 posts)

  1. Amit
    Member
    Posted 4 years ago #

    hi,
    i'm registering a custom post type and in the rewrite array try to do something like this:
    'rewrite' => array('slug' => "explore/resources/".$CATEGORY, 'with_front' => false),

    I want the rule to 'dynamically' get the posts's category name somehow.. I also tried using %category% there but it doesn't work either.

    I need the post's url to represent the entire path/route to it.. any ideas on how to achieve this?

    thanks!

  2. Josh Betz
    Member
    Posted 4 years ago #

    array('slug' => "explore/resources/%category%", 'with_front' => false),

  3. Amit
    Member
    Posted 4 years ago #

    betzster: doesn't work, tried it already.

  4. wishypw
    Member
    Posted 4 years ago #

    can someone please explain how this rewrite rule works with the permalinks settings in the dashboard/admin panel?

    Do they have to match or something? e.g. "/explore/resources/%category%/" must be defined in the custom permalink structure field?

    thanks

Topic Closed

This topic has been closed to new replies.

About this Topic