New answers tagged


You can paginate your custom loop on a page created inside WordPress, the issue with your code is that your are using "page" parameter instead of "paged" parameter; the former is used to paginate a single post parts, while the later is used to paginate post archives or multiple posts. So a paginated query on your page template should be ...


I'm very certain that you can't paginate with a custom loop in a page template. Have you tried to compare your page template with a standard one and see any differences?


It looks to me like you've gone too deep with your meta_query argument. The meta query should be an array of arrays; you've got an array of arrays of arrays. Try: $args['meta_query'] = array( array( 'key' => 'status', 'value' => 'Retained', 'compare' => '=' ) ); References WP_Meta_Query class (which is ...


I had a similar issue and maybe this is also helpful when pagination is only working sometimes: e.g. /page/1/ and /page/2/ are working and /page/3/ not. Result: Error 404. Problem is: default value (12 items each page) for posts_per_page (WordPress Settings/Reading) is loaded always from database before the template is loaded. So $args=['posts_per_page' =>...


Solved with: add_rewrite_rule('^foo/page/([0-9]+)/?$', 'index.php?category_name=category1&paged=$matches[1]', 'top'); add_rewrite_rule('^foo', 'index.php?category_name=category1', 'top'); The order between these two lines here is important. See also Permalink/Pagination issue: Category base name same as page name.


I would use something like this : $prev_link = get_previous_posts_link( '&#x000AB; ' . __( 'Previous Page' ) ); $next_link = get_next_posts_link( __( 'Next Page' ) . ' &#x000BB;' ); if ( $prev_link || $next_link ) { $pagination = $prev_link ? sprintf( '<div class="pagination-previous alignleft">%s</div>', $prev_link ) : ''; $...

Top 50 recent answers are included