Web Hosting
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix Reply To: Query Post with Custom Field Values

Discussion in 'Misc WordPress Requests' started by janak Kaneriya, Nov 11, 2017.

  1. janak Kaneriya

    Guest

    Reply To: Query Post with Custom Field Values, by janak Kaneriya

    Hello,

    Try below code.
    However you have to check date format in data base to make below query working.

    $args = array(
    'post_type' => 'tour',
    'order' => 'ASC',
    'orderby' => 'meta_value',
    'posts_per_page' => -1,
    'meta_query' => array(
    array(
    'key' => 'start_date',
    'value' => date('Y-m-d'),
    'compare' => '>=',
    'type' => 'NUMERIC'
    )
    )
    );

    $my_query = new WP_Query( $args );

    Reply To: Query Post with Custom Field Values
     
    #1

Share This Page

Web Hosting