• I have a CPT with…

    `
    ‘rewrite’ => array(‘slug’ => ‘magazine’, ‘with_front’ => false )
    ‘taxonomies’ => array( ‘category’ )

    I also have a normal category of ‘magazine’.

    Am I likely to get problems because the CPT writes to a path simliar to a category?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi, @gulliver. Off the top of my head, the only scenario where I could see this being a potential problem is if you have also disabled WordPress’s category base.

    In other words, under “normal” circumstances, your magazine category archive URL would look like this:

    http://example.com/category/magazine

    and then the CPT archive URL would look like this:

    http://example.com/magazine/

    so WordPress would be able to distinguish them from one another.

    But if you’ve disabled the category base, then your magazine category archive URL would be identical to the CPT archive URL, and that would surely be a problem.

    Thread Starter gulliver

    (@gulliver)

    Thanks.

    You’ve confirmed what I thought might be an issue…

    Category base is disabled because I don’t normally use categories – everything goes into a default ‘misc’.

    But for one project I needed a CPT for an extra section of the site… so a CPT of ‘item’ publishes into a root-relative path of /magazine/item-name/, thus saving having to create a category of ‘magazine’.

    But, in using a third-party script to enable such posts to be restricted to members, category-level protection was the easiest option and hence I created the otherwise redundant category of ‘magazine’ solely for this purpose.

    Extra code auto-publishes all ‘item’ CPTs into that category, and removes category meta boxes from the compose/edit screens.

    I could change the CPT path to avoid a conflict.
    I think I’ve some other rewrite code buried in my functions which might affect what gets priority.
    And I’m not sure whether I want to show a category archive, or do so with an appropriately coded normal page.

    Clearly, I should have thought more about this… but I so rarely use categories and CPTs that much of it is a mystery to me.

    Probably a good time to add some archives/pages and see what happens.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘CPT, category, URL path.’ is closed to new replies.