Ok, I got it working, thank you.
Here’s my working test example:
<br />
$all_posts = get_posts(array('numberposts' => -1, 'category' => $current_cat, 'orderby' => $orderby, 'order' => $order));<br />
$all_post_ids = array();<br />
foreach($all_posts as $post){<br />
if(!in_array($post->ID, $sticky_post_ids)){<br />
$all_post_ids[] = $post->ID;<br />
}<br />
}<br />
$merged_all_post_ids = array_merge_recursive($sticky_post_ids,$all_post_ids);<br />
Where $sticky_post_ids was a simple array with post ID’s like: array(12, 54, 32).
And my WP_Query args: array( 'orderby' => 'post__in', 'post__in' => $merged_all_post_ids )
.
And I had to modify the plugin function a bit, which now looks like this:
<br />
function sort_query_by_post_in( $sortby, $thequery ) {<br />
global $wpdb;<br />
if ( ! empty( $thequery->query['post__in'] ) && isset( $thequery->query['orderby'] ) && $thequery->query['orderby'] == 'post__in' )<br />
$sortby = "find_in_set(" . $wpdb->prefix . "posts.ID, '" . implode( ',', $thequery->query['post__in'] ) . "')";<br />
return $sortby;<br />
}<br />
add_filter( 'posts_orderby', 'sort_query_by_post_in', 10, 2 );<br />