Correct Hook/Filter to amend category choices on post edit page

I managed to solve this issue using pre_get_termsas an action and then updating the query_vars $current_user = get_current_user_id(); $user_field = “user_”.$current_user; $user_categories = get_field(‘post_categories’, $user_field); if(in_array(‘category’,$terms->query_vars[‘taxonomy’])){ $terms->query_vars[‘include’] = $user_categories; } return $terms;

Display some WordPress categories as random order

get_categories doesn’t allow you to set rand as orderby AFAIR, but that’s not a big deal. It returns an array, so in your case all you have to do is to shuffle that array: <?php $categories = get_categories( array( ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘exclude’ => ‘all’, ‘include’ => ‘135,19,124,133,126’, ) ); shuffle ( … Read more