1function get_the_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
2 $post = get_post();
3 return ! empty( $post ) ? $post->ID : false;
4}
5
1$post = get_post( 123 ); // Where 123 is the ID
2$output = apply_filters( 'the_content', $post->post_content );
1get_posts(array(
2 'fields' => 'ids', // Only get post IDs
3 'posts_per_page' => -1
4));
5
1//WordPress: Query a specific post by its post type & ID
2//For example, query Case Study with ID #12345
3
4<?php query_posts('post_type=case_studies&p=12345'); ?>
5
6/*To determine a post ID, refer to the
7URL of the post while editing it:
8http://localhost...wp-admin/post.php?post=12345...*/