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 have 2 custom post types : "industry" (page + hierarchical) and "product" (post + hierarchical). This allows me to use Industry for Product's post_parent.

On the Product manage screen, I have a custom column that displays the title of the product's post_parent, an industry. I would like to make that column sortable.

function column_orderby ( $vars )
    $output = array();

    switch ( $vars['orderby'] )
        case 'industry':

            orderby post_parent's title

        case 'product': // Custom column that just displays post_title differently
            $output = array(
                'orderby' => 'title'

    return array_merge($vars, $output);
add_filter('request', 'column_orderby');

I don't think I can merge any useful parameters. It has crossed my mind to use the posts_join and/or posts_where filters, but I'm not sure if this would work.

My question is, should I experiment with the hooks mentioned above or is there another way I'm not thinking of?


share|improve this question

Your Answer


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

Browse other questions tagged or ask your own question.