• Resolved magicmiles

    (@magicmiles)


    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)
  • You have the value set to 'true'. Is it really a string ‘true’ or is it a boolean?

    Thread Starter magicmiles

    (@magicmiles)

    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 6 years, 1 month ago by magicmiles.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WP Query with Custom Fields ?’ is closed to new replies.