Vladimir’s WordPress Forum


 
Current User: Guest
Search Forums:


 






Wildcard Usage:
*    matches any number of characters
%    matches exactly one character

Accessing $POST object within plugin

Add a New Topic Reply to Post
UserPost

23:11
13 October, 2010


KC

Guest

Hello,

I am having trouble accessing the post variable outside the loop.

My plugin code is as follows:

global $wp_query; // trying to make any variable I have found reference to be involved in $post global so it can be accessed
global $post;
global $posts;

echo $post->post_content; // returns nothing

add_filter( 'the_content', ds_add_to_content);
echo get_the_content() . "hello"; //returns hello
var_dump($post); // returns null
echo ($post->post_content); // returns nothing

My questions:

1) Is a plugin considered part of the loop?

2) I have included code with the output I have found using xdebug. Nothing I have tried has allowed me to access the $post object. Can you give me any advice on how to do this.

Thanks again in advance,

KC:

Reply to Post

Reply to Topic:
Accessing $POST object within plugin

Guest Name (Required):

Guest Email (Required):

HTML Editor
Smileys
Confused Cool Cry Embarassed Frown Kiss Laugh Smile Surprised Wink Yell
Post New Reply

Guest URL (required)

Math Required!
What is the sum of:
11 + 11