admin管理员组

文章数量:1122832

I have defined a custom post type. On the admin listing screen I am filtering this based on a querystring argument. So if my querystring includes 'filter=abc' I show a subset of my custom posts, if the querystring does not include the filter parameter I show a different subset.

The paging navigation buttons respect my querystring parameter, so if I'm on 'filter=abc' and move to the next page, my querystring argument is still present.

However if I use the search box, or navigate directly to a different page number, the parameter is lost. This is obviously because it is not present anywhere in the form with id 'posts-filter'.

I could use DOM manipulation to add a hidden form field to the form, but this feels clumsy. Is there a better way to get WordPress to include my querystring parameter in the form?

Note that I'm not asking about pre_get_posts here, I know how to add this parameter to WP_Query once it is passed to the page. The question is how do I make sure my parameter is passed around when navigating the admin listing page.

Thanks

本文标签: wp queryHow to add an extra parameter to searches on the admin listing screen for my custom post type