Added a new post type like this:

add_action( 'init', 'one' ); function one() { register_post_type( 'one', array( 'public' => true, 'labels' => array( 'name' => 'one', 'all_items' => 'Показать все', 'add_new' => 'Добавить', 'add_new_item' => 'Добавление' ), 'supports' => array( 'title', 'editor', 'thumbnail' ), 'menu_icon' => 'dashicons-shield', 'taxonomies' => array( 'post_tag', 'category ') ) ); }; 

enter image description here

I added tags to this new category, but I just can’t figure out how to put tags on the list, specifically the tags of this entry, I can’t understand if she has an id or not, help me figure it out.

  • one
    The question is not clear. What exactly to bring, where, where? Are these tags a native taxonomy tied to a custom type, or a custom with the same name? - SeVlad
  • I do not have enough knowledge to understand your question, I will try to explain in more detail. I added a new post type with the register_post_type function, added the ability to add 'taxonomies' => array( 'post_tag') . I do this in order to further sort the records from the category that I added. And now I just need to display a list of these tags, for example through WP_Query - Alexander
  • one
    First of all, sorry - I didn’t look at the code and didn’t see how the labels were added. This question is removed. Secondly, these tags are common with records. They are displayed for example. in the "tag cloud" (or where should I get it?). In the third it is not clear about the category - this taxonomy is not in this custom type. - SeVlad
  • one
    If I recommend that the plugin wordpress.org/plugins/custom-post-type-ui create your own post type and the necessary taxonomy, and then taking the code from it (it shows php) and slightly changing the name of the functions use them in your plugin for this type of post . - SeVlad

1 answer 1

Standard tags in Wordpress are displayed like this:

 <?php if(has_tag()){the_tags('<div class="tag">','','</div>');}?>