0

有没有办法从 wordpress 导出所有可下载的内容?

我在网上找到了这篇文章的代码,但我需要可下载的内容,比如我所有的 PDF、wordfiles

    <?php

include "wp-load.php";

$posts = new WP_Query('post_type=any&posts_per_page=-1&post_status=publish');
$posts = $posts->posts;
/*
global $wpdb;
$posts = $wpdb->get_results("
    SELECT ID,post_type,post_title
    FROM {$wpdb->posts}
    WHERE post_status<>'auto-draft' AND post_type NOT IN ('revision','nav_menu_item')
");
*/

header('Content-type:text/plain');
foreach($posts as $post) {
    switch ($post->post_type) {
        case 'revision':
        case 'nav_menu_item':
            break;
        case 'page':
            $permalink = get_page_link($post->ID);
            break;
        case 'post':
            $permalink = get_permalink($post->ID);
            break;
        case 'attachment':
            $permalink = get_attachment_link($post->ID);
            break;
        default:
            $permalink = get_post_permalink($post->ID);
            break;
    }
    echo "\n{$post->post_type}\t{$permalink}\t{$post->post_title}";
}

有人能帮我吗?

4

1 回答 1

1

Wordpress 将此内容存储在 wp-content/uploads/ 目录中。您可以通过使用 FTP 或类似方式下载该文件夹来提取所有内容。

于 2013-10-15T17:52:02.080 回答