I have 4 text fields in a custom post type. How can I sort the posts by this order of text fields: brand_fbn - model_fbn - year_fbn - plate_number?

This is my code, which isn't working:

$ins = new WP_Query( array(
    "post_type" => "application-list",
    "author"    => $current_user->ID,
    "meta_key"  => array( "year_fbn", "plate_number" ),
    "orderby"   => "meta_value ",
    "order"     => "ASC"
) );

I know this line won't work: "meta_key" => array( "year_fbn", "plate_number" )



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy