Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

require("wp-load.php");
$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

1 Answer 1

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

 
discard

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.