I need to get a list of posts based a certain value in their meta key “所在房号”, which is actually a pattern.
$pattern = '/$floor(([0-2][0-9])|88)/';
$args = array( 'numberposts' => $totalposts, 'category'=> $building, 'orderby' => $orderby, 'meta_key' => '所在房号', 'meta_value' => $pattern );
$myposts = get_posts($args);
So if $floor is 9, the function will match on the meta value that has value of 900-929, and 988 (anywhere in the string). But the problem is, someone told me that get_posts doesn’t accept regular expression, that I need a posts_where hook. I checked out the codex here http://codex.wordpress.org/Custom_Queries, but I just couldn’t figure out what to do with the function. It’s so confusing. Can someone explain it? or provide an example?
Angela