Filter posts by taxonomy in wp admin

add_filter('parse_query', 'function_name'); function function_name($query) { global $pagenow; $q_vars = &$query->query_vars; $post_type='xxxx'; $taxonomy='xxx'; if ( $pagenow == 'edit.php' && isset($q_vars['post_type']) && $q_vars['post_type'] == $post_type && isset($q_vars[$taxonomy]) && is_numeric($q_vars[$taxonomy]) && $q_vars[$taxonomy] != 0 ) { $term = get_term_by('id', $q_vars[$taxonomy], $taxonomy); $q_vars[$taxonomy] = $term->slug; } }
Filter posts by taxonomy in wp admin

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.