Support » Fixing WordPress » Custom Post type category and tags

  • [ Moderator note: moved to Fixing WordPress. Please do not use Developing With WordPress for these topics. ]

    hi!
    i’ll maked a custom post type with: https://generatewp.com/post-type/

    but i cannot generate also category and tags.

    work only if i use default tags and category but this is “scramble” with articles.

    so, my question is: how i can use custom tags and categories for a custom post type?

    thanks in advance,
    S.N.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,

    You have to use custom taxonomy.
    https://generatewp.com/taxonomy/

    Change the ‘post’ in register_taxonomy to your custom post type.

    Thank you

    thank’u so much 😀
    work as expected now 😉

    also, can i insert two custom field in this custom post type and disable add media? 🙂

    finally, i need also (and stop, really) to set as post format like “quote”
    something like: enable post format for this custom post type, but enable only quote format (then, apply to default).

    • This reply was modified 2 years, 7 months ago by Salvatore. Reason: finally

    Hi,

    I do not know if it’s possible to disable add media.

    As for custom field, you can refer to the following example.
    https://premium.wpmudev.org/blog/creating-meta-boxes/

    For the add_meta_box function, there is a $screen variable, it should be your custom post type
    https://developer.wordpress.org/reference/functions/add_meta_box/

    In the example, the custom post type is ‘food’, replace with your custom post type.

    Thank you

    thank’u.
    for media, i’ll use this:

    function check_post_type_and_remove_media_buttons()
    {
    	global $current_screen;
    	// use 'post', 'page' or 'custom-post-type-name'
    	if( 'quotes_db' == $current_screen->post_type )
    	{
    		remove_action('media_buttons', 'media_buttons');
    	}
    }
    add_action('admin_head','check_post_type_and_remove_media_buttons');

    all seems to work as expected

    i need just, if is possible, to set “post format” to quote, but isn’t more important ^_^

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom Post type category and tags’ is closed to new replies.