Support

Account

Home Forums Front-end Issues Sorting $posts = get_field(''); with another custom field value

Unread

Sorting $posts = get_field(''); with another custom field value

  • I have a relationship field called just_like.
    I use the following snippet to check if there are posts containing the value

    $posts = get_field('just_like');

    This seems to work as intended.

    I have another custom field called post_likes_count which stores a numerical value.

    How would I filter the posts using AND condition.
    I have tried the following without much luck

    `’numberposts’ = -1,
    ‘post_type’=’software’,
    ‘meta_query’=array(‘relation’=’AND’,array(‘key’=’post_likes_count’,
    ‘value’=”, ‘meta_compare’=’!=’, ‘orderby’=’meta_value_num’, ‘order’=’DESC’,), array(‘key’=’just_like’, ‘value’=”, ‘meta_compare’=’!=’,)
    ));’

Viewing 1 post (of 1 total)

The topic ‘Sorting $posts = get_field(''); with another custom field value’ is closed to new replies.