I don’t see a way to do this with WP_Query
alone. However…
function posts_where_add_post_wpse_96030($where) {
global $wpdb;
return $where." OR {$wpdb->posts}.ID = 1";
}
add_filter('posts_where','posts_where_add_post_wpse_96030');
$query = new WP_Query( 'cat=9' );
That will alter the query everywhere it runs so you will need to add conditions to the callback so that $where
is only altered where you want it to be. For example…
function posts_where_add_post_wpse_96030($where) {
global $wpdb;
if (is_home()) {
$where .= " OR {$wpdb->posts}.ID = 1";
}
return $where;
}
Now the query will only be altered when it runs on a page where is_home
is true. I don’t know what conditions you need. You didn’t include that in your question so you will have to work that out yourself.