Documentation - Actions / Filters - Filter – Admin – Restrict certain/all taxonomies for a Sort

Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInPrint this page

Filter – Admin – Restrict certain/all taxonomies for a Sort

This filter can be used to restrict the usage/view of a custom taxonomy for a Sort.

apto/admin/sort-taxonomies

Examples

The following code will restrict a taxonomy usage with a name ‘service_category’ for a Sort with ID of 82:

add_filter('apto/admin/sort-taxonomies', 'theme_apto_sort_taxonomies', 10, 2);
function theme_apto_sort_taxonomies($taxonomies, $sortID)
    {
        if($sortID == 82)
            {
                if (array_search('service_category', $taxonomies) !== FALSE)
                    unset($taxonomies[array_search('service_category', $taxonomies)]);
            }
                
        return $taxonomies;
    }

To remove all taxonomies interfaces, the flowing code can be used:

add_filter('apto/admin/sort-taxonomies', 'theme_apto_sort_taxonomies', 10, 2);
function theme_apto_sort_taxonomies($taxonomies, $sortID)
    {
        $taxonomies = array();
                
        return $taxonomies;
    }

*This code should be used within the theme or a custom plugin.