Wp_query – Custom Fields

$args = array( ‘category_name’ => ‘courses’, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’, ‘meta_query’ => array( array( ‘key’ => ‘front_page’, ‘value’ => ‘yes’, ‘compare’ => ‘LIKE’, )) ); $the_query = new WP_Query( $args );

$args = array(
        'category_name' => 'courses',
        'orderby'       => 'menu_order',
        'order'         => 'ASC',
        'meta_query' => array(
            array(
                'key'     => 'front_page',
                'value'   => 'yes',
                'compare' => 'LIKE',
            ))

);

$the_query = new WP_Query( $args );

Share this Tutorial