WordPress.org

Support

Support » How-To and Troubleshooting » Sort posts in admin in numeric order

Sort posts in admin in numeric order

  • Hi,

    I’m making a site where all the post titles are numbers, and I would like to be able to sort them in ascending numeric order.

    I’ve found this in admin/includes/post.php on line 832 in 2.9.1, and changed the order by title:

    if ( isset($q['post_status']) && in_array( $q['post_status'], array_keys($post_stati) ) ) {
    		$post_status_q = '&post_status=' . $q['post_status'];
    		$post_status_q .= '&perm=readable';
    	}
    
    	if ( isset($q['post_status']) && 'pending' === $q['post_status'] ) {
    		$order = 'ASC';
    		$orderby = 'title';
    	} elseif ( isset($q['post_status']) && 'draft' === $q['post_status'] ) {
    		$order = 'ASC';
    		$orderby = 'title';
    	} else {
    		$order = 'ASC';
    		$orderby = 'title';
    	}

    But it doesn’t order the titles numerically.. I know of the sort() function, but I can’t figure out where to put it in order to sort the post-array..

    Any help will be humbly appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Sort posts in admin in numeric order’ is closed to new replies.