• Hello,

    I want to order my loop by custom field first. Example:

    – This post has custom field set to 1
    – This post has no custom field value
    – This post has no custom field value

    When adding this to the hook:

    $query->set('meta_key', 'custom_field_name');
    $query->set('meta_value', 'custom_field_value');

    This is returned:
    – This post has custom field set to 1

    I however want to other posts to be displayed as well.

    So it’s sorted on custom field value first, and then on date.

    It’s important that the pagination keeps working as well.

    Hoping for help!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Order by custom field first’ is closed to new replies.