Monday, August 22, 2022
HomeWordPress DevelopmentWP Question orderby ACF boolean values and ACF discipline worth

WP Question orderby ACF boolean values and ACF discipline worth


I’ve a customized put up sort with the next ACF fields related:

  1. doctor (boolean true/false)
  2. mid_level (boolean true/false)
  3. provider_last_name (string textual content)

I’m trying to show the posts within the following order:

  1. Physicians, sorted by Final Identify
  2. Mid-Ranges, sorted by Final Identify
  3. Any remaining posts, sorted by Final Identify

I’m utilizing the next WP_Query parameters however it’s not working:

$suppliers['meta_value'] = 'provider_last_name';

$suppliers['meta_query'] = array(
    'relation' => 'OR',
    array(    
        'is_physician'     => array(
            'key'     => 'doctor',
            'evaluate' => 'EXISTS',
        ),
        'is_not_physician' => array(
            'key'     => 'doctor',
            'evaluate' => 'NOT EXISTS',
        ),
        'is_mid_level'     => array(
            'key'     => 'mid_level',
            'evaluate' => 'EXISTS',
        ),
        'is_not_mid_level' => array(
            'key'     => 'mid_level',
            'evaluate' => 'NOT EXISTS',
        ),
    ),
);

$suppliers['orderby']    = array(
    'is_physician' => 'DESC',
    'is_mid_level' => 'DESC',
    'meta_value'   => 'ASC',
);

Any assist is far appreciated!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments