We are currently on vacation until 21st July 2025, ticket responses maybe be longer than normal during this period, sorry for any inconvenience.

Limited Number of Posts Exported by Date

Closed

Import WP Pro Updated 5 months ago 1 Reply

Oliver asked 5 months ago on February 27, 2025 at 10:15 am

I\’ve got a website that I\’m migrating and it has in excess of 25,000 posts! We only want to export the previous 5 years worth of posts.

Is there a way we can do this? It would be great if when exporting the posts from the source site we could set a date range to do them in batches.

J

James replied Support Agent

5 months ago on February 27, 2025 at 11:13 am

Hi Oliver,

You can modify the date range of the export by using the following code in your website (between 1st and 15th of january 2025):

add_filter('iwp/exporter/post_query', function ($query) {

    $query['date_query'] = [
        [
            'after' => '2025-01-01',
            'before' => '2025-01-15',
            'inclusive' => true,
        ]
    ];

    return $query;
});

James