[wp-hackers] two plugins hacking the query,
ne'er the two shall meet...
davebytes at comcast.net
Sat Feb 17 17:44:12 GMT 2007
I have two really simplistic plugins I've made, both take control of the
wp query in different ways, but both use fields from the postmeta table
to do their work. Needless to say, they have a conflict!
Plugin #1 uses one postmeta field to order-by the end results of the
query (by a user-specified rating/priority).
Plugin #2 uses a different postmeta field as part of a query match/WHERE
clause to filter results. (Search plugin...)
The issues are:
- both want to set up a LEFT JOIN on the postmeta table (which I could
sort of workaround... but not quite...)
- bc plugin #1 was JOINing on a particular named field, and then just
assuming it could ORDER BY postmeta.value (bc there was originally only
every one pm value in the result!), adding another postmeta field to the
query borks the ORDER BY ability.
Anyone good with wp/mySQL queries at this complexity level? My gut
instinct says I either need to join on all postmeta's for the given
post, but somehow 'alias' the particular named field for the ORDER BY
(I've yet to see that this can be done), or might need to rework the
ordering plugin somehow (post-query sorting doesn't work with LIMIT
paging through results, so that screws me up...). At the moment, I
disable the ordering override when doing Searches, so the search gets
the custom results, just not ordered properly.
More information about the wp-hackers