I am using a custom WP_List_Table-Class in order to display a custom table with hotels in the dashboard. I can skip through the pages with the pagination on the top right as expected.

The search form is also added with

$my_list_table_instance->search_box( 'Search', 'search_id' );

and it is working fine, but only for the first page.

Inside the form, I have the two hidden fields for the pagination:

// List and form output
$page  = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRIPPED );
$paged = filter_input( INPUT_GET, 'paged', FILTER_SANITIZE_NUMBER_INT );
echo '<form method="post" id="list-hotels-form">';
printf( '<input type="hidden" name="page" value="%s" />', $page );
printf( '<input type="hidden" name="paged" value="%d" />', $paged );
$hotel_table->search_box( __( 'Search Hotels', 'uruk' ), 'search_id' );
echo '</form>';
// ...

The Problem

When sending the search form by post method, I do not get a (unaesthetically) long query string. The search terms are inserted into the search form again, but they are not appended to the pagination links. So when skipping to the following page of results, I lose the search terms.

My Question(s)

  • How can I add a query argument to the pagination links when a search term is present? The method set_pagination_args() does not allow to append custom arguments to the pagination links.
  • Better send the form by get (as recommanded here) from the beginning and rebuilding the form action-value from the ground? Otherwise the action-value is getting much too long, since the referrer is appended each time.
  • Did you ever solve this? I am experiencing the same problem... Sep 18, 2015 at 23:03
  • @brianjohnhanna: Nope. I am still sending the form by GET.
    – uruk
    Sep 21, 2015 at 18:52
  • Perhaps this might be of use. It worked for me. wordpress.stackexchange.com/a/213281/86029
    – oooorgle
    Dec 30, 2015 at 10:43
  • Thanks for your link, but in this example, the form is also sent by GET.
    – uruk
    Dec 30, 2015 at 18:26

1 Answer 1


This issue I have also faced and suggestion the solution

By adding this much javascript to update the pagination links using jquery by adding search in page links.

if($("#listing-tbl").length) {
        if($("#search-search-input").length) {
            var search_string = $("#search-search-input").val();
            if(search_string != "") {
                $("#listing-tbll .pagination-links a").each(function() {
                    this.href = this.href + "&s=" + search_string;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.