Created
December 25, 2015 21:51
-
-
Save sarvar/9f7c24ff390dcd5fd603 to your computer and use it in GitHub Desktop.
Sort Posts (or Pages) by title
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Set Post Order In Admin | |
Version: 0.1 | |
Plugin URI: http://wordpress.org/support/topic/336715/ | |
Description: In Posts->Edit, display posts in title order. | |
Author: MichaelH | |
Author URI: http://codex.wordpress.org/User:MichaelH/MyPlugins | |
*/ | |
function set_post_order_in_admin( $wp_query ) { | |
if ( is_admin() ) { | |
$wp_query->set( 'orderby', 'title' ); | |
$wp_query->set( 'order', 'ASC' ); | |
} | |
} | |
add_filter('pre_get_posts', 'set_post_order_in_admin' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment