Title: WP Query with Custom Fields ?
Last modified: February 11, 2019

---

# WP Query with Custom Fields ?

 *  Resolved [magicmiles](https://wordpress.org/support/users/magicmiles/)
 * (@magicmiles)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/wp-query-with-custom-fields/)
 * I’m trying to add custom fields to a custom post type query. The query works 
   fine, but now that I’m trying to add a flag field (tt_freemium) to the query,
   it’s not seeing the change. So, as a result, the query is pulling everything 
   as it normally would instead of the flagged items. There should be just one in
   the query result in this test. Help, what am I doing wrong ????
 *     ```
       <?php $args = array( 
       'post_type' => 'membercontent',
       'meta_query' => array(
             array(
                  'key' => 'tt_freemium',
                  'value'   => 'true',
             ),
       'orderby' => 'post_date', 
       'order' => 'DESC', 
       'posts_per_page' => '200' );
   
       $ourposts = new WP_Query( $args );?>
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Joy](https://wordpress.org/support/users/joyously/)
 * (@joyously)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/wp-query-with-custom-fields/#post-11194179)
 * You have the value set to `'true'`. Is it really a string ‘true’ or is it a boolean?
 *  Thread Starter [magicmiles](https://wordpress.org/support/users/magicmiles/)
 * (@magicmiles)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/wp-query-with-custom-fields/#post-11194205)
 * string is set to true. I can set it to something else. It honestly doesn’t matter,
   just as long as the flag field contains some value that can be searched!
 * I’m going to close this item. I just discovered that the query DOES in fact work.
   My apologies folks.
 * Sorry.
    -  This reply was modified 7 years, 3 months ago by [magicmiles](https://wordpress.org/support/users/magicmiles/).

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘WP Query with Custom Fields ?’ is closed to new replies.

## Tags

 * [custom fields](https://wordpress.org/support/topic-tag/custom-fields/)
 * [wp_query](https://wordpress.org/support/topic-tag/wp_query/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 2 participants
 * Last reply from: [magicmiles](https://wordpress.org/support/users/magicmiles/)
 * Last activity: [7 years, 3 months ago](https://wordpress.org/support/topic/wp-query-with-custom-fields/#post-11194205)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
