I want to display posts sorted by slug on a page. Is it possible to order posts by slug using query_posts or Wp_query?
In WordPress the post slug is saved in database with name
post_name, so to sort posts by slug just use:
Here's the example of query:
$args = array( 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 10, 'orderby' => 'name' ); $query = new WP_Query( $args );