The export_wp WordPress PHP action fires at the beginning of an export process, before any headers are sent.
Usage
add_action('export_wp', 'my_custom_export_function');
function my_custom_export_function($args) {
  // your custom code here
  return $args;
}
Parameters
- $args (array) – An array of export arguments.
More information
See WordPress Developer Resources: export_wp
Examples
Modify export arguments
Change the default export arguments to only export posts from a specific category:
add_action('export_wp', 'modify_export_args');
function modify_export_args($args) {
  $args['category'] = 'my-category-slug';
  return $args;
}
Set custom date range for export
Export posts from a specific date range:
add_action('export_wp', 'set_custom_date_range');
function set_custom_date_range($args) {
  $args['start_date'] = '2022-01-01';
  $args['end_date'] = '2022-12-31';
  return $args;
}
Exclude specific post types from export
Exclude ‘attachment’ post types from the export:
add_action('export_wp', 'exclude_post_types');
function exclude_post_types($args) {
  $args['post_type'] = array_diff($args['post_type'], array('attachment'));
  return $args;
}
Export only published posts
Export only published posts, ignoring drafts and other post statuses:
add_action('export_wp', 'export_only_published_posts');
function export_only_published_posts($args) {
  $args['post_status'] = 'publish';
  return $args;
}
Export posts with specific meta key
Export posts that have a specific meta key:
add_action('export_wp', 'export_posts_with_meta_key');
function export_posts_with_meta_key($args) {
  $args['meta_key'] = 'my_custom_meta_key';
  return $args;
}