I've made mistake creating custom post type. I've put:

register_post_type( 'Post Name', $args );

instead of

register_post_type( 'post_name', $args );

Now I need to assign new custom taxonomy to this post type. Problem stars here:

    register_taxonomy( 'custom taxonomy', array( 'Post Name' ), $args );

doesn't work.

I've tried to change custom post type name to one string and then assign taxonomy and it works.

register_taxonomy( 'custom taxonomy', array( 'post_name' ), $args );

Problem is that because of existing content I can't change custom post type name like this. Looking for workaround that let me save my existing content.


I've checked another option and asigned my custom taxonomy to custom post type using its name but without capitals and space.

'postname' works with original 'Post Name'

So for custom post type

register_post_type( 'Post Name', $args );

I can use

register_taxonomy( 'custom taxonomy', array( 'postname' ), $args );

And it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.