Support » Plugin: Custom Post Type UI » Unable to edit Post Types

  • Resolved epoka

    (@epoka)


    Hi,
    I’ve created Post Type names “output”. I would like to edit it:
    1. Rename archives from “outputs” to “products”
    2. Add Custom Rewrite Slug “product”.

    I can’t do it because plugin gives me information:
    “Please choose a different post type name. output is already registered.”

    So it thinks I want to create new Custom Post Type named the same as already existing.

    Can you please help me with this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Michael Beckwith

    (@tw2113)

    Good day @epoka,

    I have been able to confirm that I can recreate the issue, and after some digging in and debugging, I believe this is coming down to a missed copy/paste error on my part from the 1.5.3 release.

    To provide some context, 1.5.3 had a change added that addressed preventing renaming post types to reserved slugs for both post types and taxonomies after an initial save. For example if I named my post type “mypost” and then tried to rename it to “post” later, I would be denied.

    In version 1.5.7, I added “output” to the reserved taxonomy list so that taxonomies couldn’t be named, or renamed, to that. It was messing with menu usage from WP core.

    Here’s where the copy/paste error comes in. If you go to the following link, the highlight should show a function named cptui_updated_post_type_slug_exists

    https://github.com/WebDevStudios/custom-post-type-ui/commit/f2c6d8ecc3734afc951c97d829de057e42ee31cc#diff-9882fccf5a1c2115d02478600ebd24d1R1697

    About 3 lines below that highlighted line is our error. I’m checking for reserved post type slugs using the function that returns reserved taxonomy slugs.

    “output” isn’t a reserved post type, but as of 1.5.7, it is a reserved taxonomy. Thus this issue with saving for you.

    I will be addressing this mistake in a near future release, treating it as a bug. A little surprised that the copy/paste error hasn’t come up yet, but there are way more slugs possible than there are that match these reserved taxonomies.

    Anyways, for your part, are you comfortable with finding the spot in the current 1.5.8 copy of the plugin and updating that line to use the correct function? or would you prefer I provide a hotfixed copy of the latest release with this change in it?

    It’s at line 1694 of custom-post-type-ui/inc/post-types.php
    https://github.com/WebDevStudios/custom-post-type-ui/blob/1.5.8/inc/post-types.php#L1694

    Need to make this line:

    ! in_array( $post_type_slug, cptui_reserved_taxonomies() ) &&
    

    be

    ! in_array( $post_type_slug, cptui_reserved_post_types() ) &&
    

    Let me know if you want the hotfixed instead of editing yourself, or if you have any other questions. Thanks for bringing this to our attention as well.

    Plugin Author Michael Beckwith

    (@tw2113)

    Forgot to say that after that edit has been made, you should be able to properly save your post type like expected

    Michael thank you very much for your help.

    I can edit myself – don’t want take more of your time :). Done it and everything goes OK.

    I hope after update I will have no problems with it :).

    Support is fantastic! Thanks again!

    Plugin Author Michael Beckwith

    (@tw2113)

    Welcome. 😀

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.