Ampersand in the meta_value string used in query_posts
-
I am fairly new to wordpress and am setting up a query for all the posts in a category with a particular meta_value. The query works well, as long as there isn’t an “&” in the meta_value string.
In this case the value of $metastr is “Green & Black’s”, which returns 0 results. I checked and the apostrophe is not the issue, the ampersand seems to be the issue.
<?php query_posts(‘&meta_key=Brand&meta_value=’.$metastr.’&orderby=title&order=ASC&cat=’.$current_cat); if (have_posts()) : while (have_posts()) : the_post(); ?>
How can I run this query when the meta_value can contain ampersands?
Thank you in advance for your help!
-Lindsey
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Ampersand in the meta_value string used in query_posts’ is closed to new replies.