• Resolved Keryn

    (@b-summers)


    I’ve been trying to spit out a list of my properties and order them by city, but it seems I can’t do this because it’s stored in some sort of serialized array. Can you tell me how I can sort by a custom field?

    The following does not work…

    $args = array(
        'post_type' => 'properties',
        'meta_key' => 'pd_city',
        'orderby' => 'meta_value',
        'order' => 'DESC',
        'posts_per_page' => 5
    );
    $the_query = new WP_Query( $args );

    https://wordpress.org/plugins/post-meta/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Can't sort by meta_key because it's stored in serialized array’ is closed to new replies.