custom meta_query using a variable for the value
-
I want to do a post query of post type ‘page’ and a custom meta field called ‘related_category’.
The query appears on the taxonomy page and what it’s supposed to do is load the content of a page that is related to the current term. The idea is that the related page acts as a description for the current term allowing the client to edit this content the same as they would a regular page.
Basically what I need to do is set the ‘value’ to be $thisTerm. Calling the value as a variable is the part that’s not working for me, if I set the value to a number, it works just fine.
I’m hoping this is just a simple syntax error, that maybe there’s something different I should be doing in the array when calling a variable.
<?php $thisTerm = $term->term_id; ?> <div id="courses_content_column" class="span8"> <?php query_posts(array('post_type'=>'page', 'meta_query' => array( array ('key' => 'related_category', 'value' => $thisTerm ), ), )); ?>
The topic ‘custom meta_query using a variable for the value’ is closed to new replies.