Support

Account

Home Forums ACF PRO get_sites by custom fields options

Unread

get_sites by custom fields options

  • Hi,
    I have multisite and I have created custom options by following this steps:
    https://www.advancedcustomfields.com/add-ons/options-page/

    So for ex now I have category as text fields exist for every site as an acf-options.

    I want to get the sites by that custom acf-option.

    I tried to run this query:

    $sites = get_sites(
                    array(
                    'search' => get_search_query(),
    		'search_columns' => array('path','domain','category') 
                   )
                );

    And I tried as well to write hook for site_search_columns to add the category column:

    function custom_hook( $search_columns, $search ) {
        $search_columns[] = 'category';
        return $search_columns;	
    }
    add_filter( 'site_search_columns', 'custom_hook', 10, 3 );

    But that’s dose really work, Any idea how to add the custom acf-options to site_search_columns ?

    Thanks

Viewing 1 post (of 1 total)

The topic ‘get_sites by custom fields options’ is closed to new replies.