Extracting wordpress posts as text

This is a simple script I wrote that outputs WordPress posts on one page as text. A client needed this because they were editing the copy of the site and wanted all of it in a Word file. You can copy and paste the results or print them to pdf.

This is quick and dirty but it does the job. You may need to alter it for your purposes.



echo "


Category: ".get_category($row['post_parent'])."


echo "


function get_category($parent){
$sql="SELECT post_title FROM wp_posts WHERE post_parent = $parent" ;
$result=mysql_query($sql) or die(mysql_error());
return $row[0];

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.