WordPress.org

Ready to get started?Download WordPress

Forums

Custom post types permalinks 404 (1 post)

  1. imns
    Member
    Posted 3 years ago #

    I've created a custom post type "in_portfolio" with a rewrite to "portfolio".

    I also created a portfolio page with a slug set to "portfolio". The page uses a custom page template to display all of the items in the custom post type "in_portfolio".

    I keep getting a 404 (I've flushed my permalinks) when I try to go to an individual custom post type item and I've tracked the reason down to the fact that my page url and my custom post type url are the same ("portfolio"). If this theme were just for me, I would just rename the portfolio page slug and be done with it, but I am releasing this theme so I would like to find a solution the problem since I know people will be using these same naming conventions.

    Anyone have any ideas on how to fix this issue? It seems to me like this problem would happen all the time. You create a portfolio page, to show all the items in your custom post type portfolio ... am I doing this wrong? If I am, how should I be doing it and if not what can I do to fix the problem.

    here is my custom post type code:

    $args = array (
          'label' => __('Portfolio'),
          'public' => true,
          'supports' => array (
                    'title',
                    'editor',
                    'excerpt',
                    'thumbnail'
                ),
          'rewrite' => array (
                    'slug' => 'portfolio',
                    'with_front' => false
                )
        );
        register_post_type('in_portfolio', $args);

Topic Closed

This topic has been closed to new replies.

About this Topic