In wordpress, created a custom type and custom taxonomy. In the taxonomy archive file, taxonomy.php displayed all posts. Next added pagination. Which, if you switch to 2, 3, etc. .. the page does not work for some reason - a 404 error crashes, the page was not found. URL structure:
http: //wp_test.loc/taxnews/allnews/page/2/
taxnews is the name of taxonomy
allnews - common term name (for example, general news category)
In Settings - Reading - To display on the blog pages no more, it is worth the number 3, posts 8 pcs.
// ΠΎΠΏΡΠ΅Π΄Π΅Π»Π΅Π½ΠΈΠ΅ id ΡΠ΅ΡΠΌΠ° $term_id = get_queried_object()->term_id; // ΠΎΠΏΡΠ΅Π΄Π΅Π»Π΅Π½ΠΈΠ΅ Π²ΡΠ΅Ρ
Π΄Π°Π½Π½ΡΡ
ΡΠ΅ΡΠΌΠ° $term = get_term_by( 'id', $term_id, 'taxnews' ); print_r($term); // ΠΎΠΏΡΠ΅Π΄Π΅Π»Π΅Π½ΠΈΠ΅ ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²Π° ΡΡΡΠ°Π½Ρ Ρ Π·Π°ΠΏΠΈΡΡΠΌΠΈ $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; // ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΠ΅ Π·Π°ΠΏΠΈΡΠ΅ΠΉ ΡΠΊΠ°Π·Π°Π½Π½ΠΎΠ³ΠΎ ΡΠ΅ΡΠΌΠ° Π² ΡΠΊΠ°Π·Π°Π½Π½ΠΎΠΉ ΡΠ°ΠΊΡΠΎΠ½ΠΎΠΌΠΈΠΈ $query = new WP_Query( array( 'post_type' => 'news', 'posts_per_page' => 3, 'paged' => $paged, 'tax_query' => array( array( 'taxonomy' => 'taxnews', 'field' => 'slug', 'terms' => $term->slug ) ) ) ); if ( $query->have_posts() ) { while ( $query->have_posts() ) { $query->the_post(); if ( get_post_type() == 'news' ) { the_title(); } } // Π²ΡΠ²ΠΎΠ΄ ΠΌΠ΅Π½Ρ Π½Π°Π²ΠΈΠ³Π°ΡΠΈΠΈ echo paginate_links( array( 'current' => max( 1, get_query_var( 'paged' ) ), 'total' => $query->max_num_pages, 'post_type' => 'news', ) ); wp_reset_query(); }