404 error when navigating to the page taxonomy, what's wrong?

Hello,
Had a question and needed an explanation...
There is a structure of arbitrary taxonomies:
http://localhost:8089/stati/post/
where
stati — created custom taxonomy;
post — created in an arbitrary taxonomy category (term).
In the random category of the taxonomy we see the name and number of records included in this category. If we try to open this column, it is at: http://localhost:8089/stati/post/gives a 404 error.
Question 1:
Why produces an error?
Question 2:
Why in the presence of archive-stati.php open an arbitrary taxonomy (localhost:8089/stati/)?
And when taxonomy-stati.php (in the absence archive-stati.php) displays on archive.php???
Code like this (briefly):
add_action( 'init', 'true_register_stati' ); // Use the function only inside the init hook

true_register_stati function() {
 $labels = array(
 'name' => 'Article',
...
);
 $args = array(
 'labels' => $labels,
 'description' => __( 'Description.', 'your-plugin-textdomain' ), // (string) a short descriptive summary of what the post type is.
 'query_var' => true, // sets the query_var key for this post type. The key defaults to $post_type. If false, the message Type cannot be loaded in ?{query_var} = {post_slug}. If specified as a string, the query ?{query_var_string} = {post_slug} will be valid.
 'rewrite' => array( 'slug' => 'stati' ),
...
);
register_post_type('stati',$args);
}


add_action('init', 'create_stati_taxonomy');
create_stati_taxonomy function(){
 register_taxonomy('stati', array('stati'), array(
 'label' => ", // determined by the parameter $labels->name
 'labels' => array(
 'name' => 'Headings',
 'singular_name' => 'You are here', // display the text to name. For example: "This rubric: name of rubric | "
 'search_items' => 'Find column',
 'all_items' => 'All categories',
 'view_item' => 'View rubric',
 'parent_item' => 'Parent category',
 'parent_item_colon' => 'Parent Genre:',
 'edit_item' => 'Edit category',
 'update_item' => 'Update category',
 'add_new_item' => 'Add new category',
 'new_item_name' => 'New Genre Name',
 'menu_name' => 'Headings',
),
 'description' => ", // description of the taxonomy
 'public' => true,
 'publicly_queryable' => null, // equal to the argument public
 'show_in_nav_menus' => true, // equal to the argument public
 'show_ui' => true, // equal to the argument public
 'show_in_menu' => true, // equal to the show_ui argument
 'show_tagcloud' => true, // equal to the show_ui argument
 'show_in_rest' => null, // add in the REST API
 'rest_base' => null, // $taxonomy
 'hierarchical' => true, //false,
 'update_count_callback' => ",
 'rewrite' => true,
 //'query_var' => $taxonomy, // the name of the query parameter
 'capabilities' => array(),
 'meta_box_cb' => null, // callback function. Responsible for html code of Metabox (with version 3.8): post_categories_meta_box or post_tags_meta_box. If you specify false, the Metabox will be disabled at all
...
 ) );
}
March 19th 20 at 08:57
1 answer
March 19th 20 at 08:59
This is all because you do not understand the question, look carefully your code:
stati is not taxonomy, it's a custom post!!
post - in your case is a taxonomy!

Now look closely at your code, especially the line: register_taxonomy('stati', array('stati'), array(
What you register the taxonomy?
Sorry if wrong.
register:
register_taxonomy('stati', array('stati'), array(

In this case, notice that if 's' to substitute, say,'text', then the result will not:
localhost:8089/stati/post
,
as well
localhost:8089/text/post

In the first case - in the presence of archive-stati.php open an arbitrary taxonomy (random write) (localhost:8089/stati/), when taxonomy-stati.php (in the absence archive-stati.php) displays on archive.php.
In the second case, you want to change archive-stati.php on archive-text.php and then opens an arbitrary taxonomy (random write) (localhost:8089/text/), but taxonomy-text.php (in the absence archive-text.php) displays on archive.php.

In the end, I don't understand why additionally screwed stati not withdrawn their category... ie, output a 404 eror. - lavada_Doy commented on March 19th 20 at 09:02
I'm not in all this, so please explain to me... thank you in Advance. - lavada_Doy commented on March 19th 20 at 09:05
@lavada_Doy, That I explained everything in detail. You are confusing taxonomy and custom posts. Material heap, in the comments I will not describe in detail again just read the documentation - Eloy_Pagac commented on March 19th 20 at 09:08
@Eloy_Pagac, it is Highly desirable to have someone explain, and not sent to read, because reading is not always clear everything. About the hierarchy is clear, but does not display your heading... ie, output a 404 error...

If you register register_taxonomy('stati', array('stati'), array( it is clear that VP does not understand what he should do, because in part of the register_taxonomy('stati', ... name of a taxonomy and in part ..., array('stati'), ... - was a custom recording, however, if in the code to specify register_taxonomy('stati2', array('stati'), array(and then overwrite the slug of taxonomy 'text', when viewing a custom record in the address would be: localhost:8089/text/post
Thus, if you specify a category, say "lessons" and it will tie a record is created, then going to localhost:8089/text/lessons still displays the 404 error from 404.php even if file exists taxonomy-lessons.php. - lavada_Doy commented on March 19th 20 at 09:11
@lavada_Doy, That I explained everything in detail. You are confusing taxonomy and custom posts. That's the point that not having studied the material you do not understand what you are doing. Half a month passed, it was possible to study the whole website wp-kama) - Eloy_Pagac commented on March 19th 20 at 09:14
@Eloy_Pagac, Study, and don't understand. So please explain to compartmentalize. And you probably are not explained, and asked the question (so to speak, replied with a question):
Now look closely at your code, especially the line:
register_taxonomy('stati', array('stati'), array(

What you register the taxonomy?
- lavada_Doy commented on March 19th 20 at 09:17

Find more questions by tags WordPressTaxonomy