I need to use list of posts from wordpress in my project to generate XML. I have my own php script. In this script i use

require_once ('wp-blog-header.php');

and i am retrieving list of posts

$myposts = get_posts( $args ); foreach ( $myposts as $post ) : setup_postdata( $post );

but in this case i can't use script as XML because there are some extra headers from wp-blog-header.php. Is there any way to include wordpress posts list without headers?

  • do you need to use require_once ('wp-blog-header.php');? You can make a template that can display xml... Feb 14, 2015 at 17:37

1 Answer 1


i found solution i am using this php code to send headers

header("Content-type: text/xml", true, 200);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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