Can’t sort get_posts by post_mime_type

As told by mrwweb you have to plug into Wp_Query orderby statement.

add_filter( 'posts_orderby', 'wpse53783_order_by_post_mime_type' );

function wpse53783_order_by_post_mime_type( $orderby ) {

    global $wpdb;

    $order = substr( $orderby, strpos( $orderby, ' ' ) );

    $orderby = "$wpdb->posts.post_mime_type $order";

    return $orderby;

 }

You can apply the filter before the query then remove it with:

remove_filter( 'posts_orderby', 'wpse53783_order_by_post_mime_type' );

I didn’t tested it but should fits your needs 🙂

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)