skip to Main Content

somebody tried to fix pagination problem on my site by adding a function to your functions.php file[![screenshot – console][1]][1]

unfortunately, after updating wordpress or acf, this function does not work and when you try to go to the next page in the "atom" category, it displays 404 – Sorry, this page does not exist.

The pagination problem concerns only one category (subcategory). In the functions.php file I found a function like this:

function fix_atom_category_paged_query( $q ) {
    if ( ! is_admin() && is_category( 'atom' ) && $_GET['debug'] == 1 ) {
        $q->set( 'post_type', 'post' );
        $q->set( 'posts_per_page', 9 );
        // wp_die( var_dump( $q ) );
        return $q;
    }
}

add_action( 'pre_get_posts', 'fix_atom_category_paged_query', 2, 1 ); ```


  [1]: https://i.stack.imgur.com/rKqzT.png

2

Answers


  1. Chosen as BEST ANSWER

    I suspect that the problem with the category called "atom" is due to the canonical link building and the wordpress core build itself. Names such as rss, feed, rss2, rdf, atom may conflict.


  2. Ok, I tested it on another site. If category is called "atom", then wordpress pagination does not work for the archive of this category. I think this is WordPress problem.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search