[wp-hackers] meta_key and meta_value query variables don't work in the backend?
mgerring at emrl.com
Fri Jan 15 19:24:53 UTC 2010
What I mean is, I'm writing a plugin to allow a client to sort pages on the edit pages screen. I have it set up to sort by author, title, and date, and filter by a custom taxonomy. I want to be able to sort by custom field as well- all of the pages in this site have a custom field called "Country" with a set drop-down list of countries.
To do all the sorting and filtering so far, I used the manage_pages_query hook to add query variables to the request, and it has worked perfectly. All it does is put all the query variables in an array and pass it to the wp() function. But if I try to use the meta_key and meta_value variables, which are available if I use them in a theme (i.e. in the front end), nothing happens. So it appears that while you can pull out posts according to custom fields in a theme, you can't do the same thing on the manage pages/posts screens in the back end, and I'm wondering why.
I hope that clears it up.
On Jan 15, 2010, at 8:23 AM, Otto wrote:
> What do you mean by "front end" and "back end"? Your post isn't very clear.
> What code are you trying that doesn't work in the way you expect it to work?
> On Thu, Jan 14, 2010 at 6:59 PM, Matthew Gerring <mgerring at emrl.com> wrote:
>> Hello all. I'm using the manage_pages_query filter to sort posts in the backend. I seem to be able to use all the normal variables, except for meta_key and meta_value. They do absolutely nothing, together or separately. I dug through the source to see what was going on, but I didn't see any giveaways as to why the front end would accept that as a query variable and not the back end. Can anyone shed some light on this?
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers