Support » Fixing WordPress » Admin Custom Post Type Column Sorting Not Working

  • Hello,

    I have added a custom column to my admin edit-posts overview (also for page and 3 other custom post types). This all works just fine, but when I try to make the column sortable this does only work for the default posts and pages.

    Here is my code:

    $args = array(
       'public'   => true,
    $output = 'names'; // names or objects, note names is the default
    $operator = 'and'; // 'and' or 'or'
    $post_types = get_post_types( $args, $output, $operator );
    foreach ( $post_types as $post_type ) {
       add_filter("manage_edit-".$post_type."_sortable_columns", 'last_modified_sort');

    Also when I change this code to:

    add_filter("manage_edit-home_slider_sortable_columns", 'last_modified_sort');
    add_filter("manage_edit-portfolio_sortable_columns", 'last_modified_sort');
    add_filter("manage_edit-nectar_slider_sortable_columns", 'last_modified_sort');

    Everything works fine. But the each-loop generates exactly the same output as the hardcoded lines.

    Anyone got any ideas?

  • The topic ‘Admin Custom Post Type Column Sorting Not Working’ is closed to new replies.