I’m working on a wordpress plugin(managing background image), when I try to use
global $post;
print_r($post);
the object is empty.
Probably there is some required data (I dont know what.)
Please help me if you know.
I’m working on a wordpress plugin(managing background image), when I try to use
global $post;
print_r($post);
the object is empty.
Probably there is some required data (I dont know what.)
Please help me if you know.
You must be logged in to post a comment.
The WordPress global variable $post contains the data of the current Post within the The Loop.
This means that WordPress will assign a value to this variable in each loop iteration. Consecuently, if you’re trying to access
$post
from anywhere in your code outside the WP loop, it will be of course empty…