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 created a new post type named "Video".

When I create post for the post type, posts is ordered by title ASC.

Is it possible to order posts by date DESC please ?

register_post_type('Videos', array(
    'labels' => array(
        'name' => _x('Videos', 'post type general name'),
        'singular_name' => _x('Video', 'post type singular name'),
        'add_new' => _x('Ajouter', 'Video'),
        'add_new_item' => __('Ajouter une video'),
        'edit_item' => __('Éditer une video'),
        'new_item' => __('Nouvelle video'),
        'view_item' => __('Voir le lien de la video'),
        //'search_items' => __(' Video'),
        'menu_name' => 'Video'
    'public' => true,
    'show_ui' => true,
    'capability_type' => 'post',
    'hierarchical' => true,
    'rewrite' => array('slug' => 'video'),
    'query_var' => true,
    'supports' => array(
        'editor' => false,
        'excerpt' => false,
        'trackbacks' => false,
        'comments' => false,
        'revisions' => false,
        'thumbnail' => false,
        'author' => false,
        'page-attributes' => false,
    'taxonomies' => array('post_tag')
share|improve this question
Please add the code where you output the posts, you don't add the order_by parameter where you register the post_typ only when you query the posts – Pontus Abrahamsson Jan 17 '13 at 14:25
Oh sorry, I would like to add the order_by in the Wordpress Admin – Steffi Jan 17 '13 at 16:07
up vote 5 down vote accepted

Alright, You can just hook into the filter pre_get_posts and check is_admin. Put this in your theme or plugin:

function wpse_81939_post_types_admin_order( $wp_query ) {
  if (is_admin()) {

    // Get the post type from the query
    $post_type = $wp_query->query['post_type'];

    if ( $post_type == 'Videos') {

      $wp_query->set('orderby', 'date');

      $wp_query->set('order', 'DESC');
add_filter('pre_get_posts', 'wpse_81939_post_types_admin_order');

I also would shange the post_type "Videos" to lowercase like "video".

share|improve this answer
Okay, thanks Pontus ! I'll try this. But why is this not set by default ? Because for "Posts" is already set by "orderby DESC" – Steffi Jan 17 '13 at 21:40
Did it work for you? – Pontus Abrahamsson Jan 18 '13 at 8:15
it's not by default, coz it's set to "Name" in alphabetical order by default (or slug i guess) – Nabeel Khan May 3 at 22:51

The example above disables the ordering feature by clicking columns.

Sortable & for multiple custom post types:

function wpse_819391_post_types_admin_order( $wp_query ) {
  if ( is_admin() && !isset( $_GET['orderby'] ) ) {     
    // Get the post type from the query
    $post_type = $wp_query->query['post_type'];
    if ( in_array( $post_type, array('videos','news','text') ) ) {
      $wp_query->set('orderby', 'date');
      $wp_query->set('order', 'DESC');
share|improve this answer

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.