Hello I have a question as to why we must declare global $post; before using bits of code such as
$post->ID, $post->post_parent == '11'
and other references that use
A real life example below is using a custom field:
global $post; echo get_post_meta($post->ID, 'custom_field_name', true);
I am just curious as to why you must always declare
- The topic ‘What exactly is global $post;’ is closed to new replies.