Easier way to get a simple csv of all published posts and pages : create a php file somewhere in your WP install folder with this content :
<?php
include 'wp-load.php';
function fetch_posts(){
$args = array(
'post_type' => 'any',
'posts_per_page' => -1,
'post_status' => 'publish',
'suppress_filters' => false
);
$posts = new WP_Query($args);
$posts = $posts->posts;
foreach((array) $posts as $post){
switch($post->post_type){
case 'revision':
case 'nav_menu_item':
break;
case 'attachment':
$permalink = get_attachment_link($post->ID);
break;
case 'page':
case 'post':
default:
$permalink = get_permalink($post->ID);
break;
}
echo "\n{$post->ID}\t{$post->post_type}\t{$post->post_title}\t{$permalink}";
}
}
header('Content-type:text/plain; charset=utf-8');
echo "ID\tType\tTitle\tPermalink";
// we need all languages if wpml is installed
if(function_exists('icl_get_languages')){
$languages = icl_get_languages('skip_missing=0');
foreach((array) $languages as $lang){
// change language
do_action('wpml_switch_language', $lang['code']);
fetch_posts();
}
}
else {
fetch_posts();
}
Access it directly with your browser (or run it via some cli).
-
This reply was modified 8 years, 1 month ago by hardesfred.