WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm working with a custom post type with custom taxonomy and custom fields and trying to filter the displayed results (on admin post listing page) by the custom field values...

I've been trying to modify a function i found here to do the job to no avail:

function wpg_filter_manage_quotes() {
  global $typenow;
  if($typenow != 'quotes') {
  $post_types = get_post_types(array( '_builtin' => false));
  if(in_array($typenow, $post_types)) {
    $filters = get_object_taxonomies($typenow);

    foreach($filters as $tax_slug) {
      $tax_obj = get_taxonomy( $tax_slug );
      wp_dropdown_categories( array(
        'show_option_all' => __('Show All '.$tax_obj->label ),
        'taxonomy'        => $tax_slug,
        'name'            => $tax_obj->name,
        'orderby'         => 'name',
        'selected'        => $_GET[$tax_slug],
        'hierarchical'    => $tax_obj->hierarchical,
        'show_count'      => false,
        'hide_empty'      => true
add_action('restrict_manage_posts', 'wpg_filter_manage_quotes');

The above function works as it should to add a dropdown to filter by custom taxonomy, but for the life of me I can't figure out how to modify it to work with custom field data...

Custom Taxonomy Dropdown

I'm wanting to add a dropdown to filter by Author as well, and the author is stored as a custom field value. I've also got a list of all authors currently being used in my options array in the database... It's stored as an array in a variable like so: $wpgqs['used_authors'].

Any ideas?


The more I look at it, the more I think I'm going to have to hardcode the selectbox... If that's the case, then I guess I just need to know which filters/hooks I need to be using to add the hardcoded selectobx to that particular submit button's form?

share|improve this question

take a look at my answer to a very similar Question.

share|improve this answer
great! now I just need to get rid of the input area and simply list all the authors rather than the meta keys... lol – Nero_DCLXVI Dec 5 '11 at 20:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.