WordPress.org

Ready to get started?Download WordPress

Forums

Filtering a custom field prior to using it in query_posts meta_value? (1 post)

  1. lookslikepat
    Member
    Posted 2 years ago #

    Hey there!

    I have around 7000 posts, all with a custom field for an image's size:
    ex. 'raw' = '1024x768'
    I'm wondering about the ability to hook into an add_filter or similar, before I use it in query_posts?
    The guts of my query right now is this:

    query_posts( 'meta_key=raw&orderby=meta_value_num&order=DESC' );

    However this only sorts it by width (even though there's a letter in the string, lucky me), and I'm trying to sort it by height. I know; I should have made 2 custom fields, for W / H respectivly, but now I'm 7000 images in, too late now...

    So, IS there a way to filter the custom fields, just for a single query_posts ? i.e. not globally all the time?

    Any tips or help on this would be greatly appiciated.
    I guess there should be a way to split the existing custom field into 2, but so far I haven't found any answers on that either...

Topic Closed

This topic has been closed to new replies.

About this Topic