• Why aren’t the questions aren’t alphabetized in dashboard? This really makes it a pain to find stuff. Yes, I can click the title label and it fixes it….but this should be the default sort….NOT by date.

Viewing 1 replies (of 1 total)
  • Hi,

    Please place the following code in either your currently active WordPress theme’s functions.php file or within a plugin. This will automatically always sort your posts for you, so you don’t have to click the title column every time.

    /* Sort posts in wp_list_table by column in ascending or descending order. */
    function custom_post_order($query){
        /* 
            Set post types.
            _builtin => true returns WordPress default post types. 
            _builtin => false returns custom registered post types. 
        */
        $post_types = get_post_types(array('_builtin' => true), 'names');
        /* The current post type. */
        $post_type = $query->get('post_type');
        /* Check post types. */
        if(in_array($post_type, $post_types) && $post_type == 'faq'){
            /* Post Column: e.g. title */
            if($query->get('orderby') == ''){
                $query->set('orderby', 'title');
            }
            /* Post Order: ASC / DESC */
            if($query->get('order') == ''){
                $query->set('order', 'ASC');
            }
        }
    }
    if(is_admin()){
        add_action('pre_get_posts', 'custom_post_order');
    }

    Let me know if you need further assistance in this regard.

    Kind Regards,

Viewing 1 replies (of 1 total)
  • The topic ‘Questions aren’t alphabetized in dashboard’ is closed to new replies.