0

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?

0

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);
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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