WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm accessing a page content from outside WordPress, in a different webpage. Everything runs fine, I'm using this:

$page_id = 300;
$data = get_page($page_id);    
echo $data->the_content;

However, the content is different from what WordPress would output normally. For example, paragraphs which are separated by blank lines in source come just like that, without <p> tags. How can I get the content from a page in the same way that WordPress would print it? Should I apply some other filter or use another function to process the text?

share|improve this question
up vote 0 down vote accepted

Indeed! It's a filter called 'the_content', to which numerous other functions are hooked such as the one that turns Wordpress into WordPress, oembeds, and the p tag wrapping

echo apply_filter('the_content',$data->the_content);
share|improve this answer
Oh, I see. Thanks a lot! – dstats Mar 30 '12 at 20:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.