WP_Query by just the id?

any should retrieve any type:

$args = array(
  'p'         => 42, // ID of a page, post, or custom type
  'post_type' => 'any'
);
$my_posts = new WP_Query($args);

Note the description of any in the documentation:

‘any’ – retrieves any type except revisions and types with ‘exclude_from_search’ set to true.

For more information, have a look at the documentation of WP_Query.

Leave a Comment

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