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(); } 

    1 answer 1

    It turned out that when registering a custom record type, the option 'exclude_from_search' => 'false' had to be set to false, and I had true.