Skip to content

Instantly share code, notes, and snippets.

@Kudratullah
Created September 10, 2015 12:20
Show Gist options
  • Save Kudratullah/b0ac025dc06f19e0f0e4 to your computer and use it in GitHub Desktop.
Save Kudratullah/b0ac025dc06f19e0f0e4 to your computer and use it in GitHub Desktop.
get all post in csv
<textarea style="width: 100%; height: 299px;" onclick="select();">
<?php
$args = array(
'post_type' => array( 'post', 'page', 'media', 'news' ),
'posts_per_page' => -1,
);
echo 'Title of page, URL of Page'. PHP_EOL;
$dump = new WP_Query($args);
if($dump->have_posts()){
while($dump->have_posts()){
$dump->the_post();
echo get_the_title().",".urldecode(get_the_permalink()).PHP_EOL;
}
}
?>
</textarea>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment