Later blog post pages give 404 error

First, try rebuilding your permalinks. Go to Settings >> Permalinks and click Save, which will rebuild them. If that doesn’t work, go into your Settings >> Reading >> Blog pages show at most setting and try increasing or decreasing that and see how that changes things. Some themes have a setting that lets you adjust … Read more

I have broke my pagination, same posts on all pages (index.php)

I seem to have fixed the pagination issue with the custom loops, not entirely sure how it works, but it does seem to work. I have changed the custom loop to the following; <?php $paged = ( get_query_var(‘paged’) ) ? get_query_var(‘paged’) : 1; $the_query = new WP_Query( array( ‘post__not_in’ => get_option( ‘sticky_posts’ ), ‘posts_per_page’ => … Read more

Need help with pagination

$paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $args_blog = array( ‘post_type’ => ‘post’, ‘paged’ => $paged, ‘posts_per_page’ => get_option(‘posts_per_page ‘) ); $query_blog = new WP_Query( $args_blog ); if($query_blog->have_posts()) : while($query_blog->have_posts()) : $query_blog->the_post(); $big = 999999999; // need an unlikely integer echo paginate_links( array( ‘base’ => str_replace( $big, ‘%#%’, esc_url( get_pagenum_link( $big ) ) ), ‘format’ … Read more

Pagination using paginate_links

This is a problem with the paginate_links function and having your default permalink structure set to postname/custom but wanting the pagination to use default link structure. If you look at the code – https://core.trac.wordpress.org/browser/tags/4.8/src/wp-includes/general-template.php#L0 You can see the following at the top of the paginate_links function // Setting up default values based on the current … Read more

pagination error in taxonomy: Warning: Division by zero

$per_page is $number_of_performers, which must be an incorrect value. PS: Also you can reduce your $sort_array defines with: $sort_array = array(); $alphas = range(‘A’, ‘Z’); foreach ($alphas as $lttr) $sort_array[$lttr] = __($lttr,’framework’); UPDATE furthering @tom-j-nowell point of $total_terms being the problem – your codes wp_count_terms()‘s second argument is supposed to be an array or a … Read more

Custom post type and custom taxonomy 404 on page 2

So after many trials and errors, I found I had to create a specific rewrite rule to go into my functions.php, one that handles post type ‘videos‘ and the category (taxonomy) ‘videos_category‘: add_filter(‘init’, function() { add_rewrite_rule( ‘^videos/([^/]*)/([^/]*)/(\d*)?’, ‘index.php?videos_category=$matches[1]&p=$matches[2]&paged=$matches[3]’, ‘top’ ); }); I also found this plugin to be really helpful for viewing my rewrite rules: … Read more

404 Not Found

Not Found

The requested URL was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.