You are viewing an old revision of this post, from May 1, 2012 @ 02:01:19 [Autosave]. See below for differences between this version and the current revision.

WP Admin Custom Post Type sort order

This is a function to do it easily: This might be better: http://scribu.net/wordpress/custom-sortable-columns.html [php] /*-----------------------------------------------------------------------------------*/ /* CUSTOM ORDER A CUSTOM POST TYPE IN THE WP ADMIN EDIT.PHP SCREEN */ /*---------------------------------------------------------------------*/ function posts_for_current_author($query) { if($query->is_admin) { if ($query->get('post_type') == 'articles') { $query->set('orderby', 'date'); $query->set('order', 'DESC'); } } return $query; } add_filter('pre_get_posts', 'posts_for_current_author'); [/php]

Revisions

Revision Differences

There are no differences between the May 1, 2012 @ 02:01:19 [Autosave] revision and the current revision. (Maybe only post meta information was changed.)

Tags: , , ,

No comments yet.

Leave a Reply