WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Can I limit Export or Import of posts to Draft only? (2 posts)

  1. jsherk
    Member
    Posted 5 years ago #

    I am transferring some posts from a WP2.5 install, but I only want the DRAFT posts. Manually editing the XML file would be very time consuming due to the number of posts.

    Is there a way to limit the exported posts so only draft get exported?

    Or is there a way to limit the import of posts (WP2.7.1) so it only reads in the Draft ones?

    Thanks

  2. jsherk
    Member
    Posted 5 years ago #

    I modified the wp-admin/includes/export.php in my WP 2.5 install to export Posts only with a status of Draft. This mode should be very similar for most versions of WP.

    In the wp-admin/includes/export.php file, look for this line:
    $post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");

    Just BEFORE it, add the following line:

    //NOTE: This modification ignores your choice of Author, and chooses them all!
    $where = " WHERE post_type = 'post' AND post_status = 'draft' ";

Topic Closed

This topic has been closed to new replies.

About this Topic