bbPress Pagination – Increase or Show All Page Numbers

By default, bbPress pagination only shows a few page numbers. You could navigate and search for forum topics easily if more page numbers are shown. See image below.

bbPress Forum Topic Pagination
bbPress default pagination on top. The one below shows all of the available pages.

Show All Page Numbers

If you want to show all of the available page numbers, you’ll have to add the code below on your theme’s functions.php. Showing all pages might not be ideal for all cases.

function ra_bbp_all_pagination($arr) {
    $arr['show_all'] = true;
    return $arr;
}
add_filter( 'bbp_topic_pagination', 'ra_bbp_all_pagination' );

Increasing Page Numbers that are Shown

If you have thousands of topic pages, you may not want to show all of them but instead only increase the page numbers that are visible. The end_size value is how many numbers on the beginning and end of the page navigation while the value for mid_size dictates how many numbers are shown on either side of the current page.

function ra_bbp_increase_pagination($arr) {
    $arr['end_size'] = 5;
    $arr['mid_size'] = 2;
    return $arr;
}
add_filter( 'bbp_topic_pagination', 'ra_bbp_increase_pagination' );

Leave a Reply

Please write your comments in english. I delete anything that even remotely resembles spam.

Note: When posting code, enclose it in pre and code tags.
e.g. <pre><code> Add code here </code></pre>