Export Tasks
These tasks export WordPress data to downloadable files. All exports are attached to the current user's account for easy retrieval.
ExportTaxonomyTask
Class: Maintenance::Wordpress::ExportTaxonomyTask
Export WordPress tags or categories to a CSV file.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
locale | string | Conditional | - | WordPress site locale (required unless exporting all) |
taxonomy | string | Yes | tags | Either tags or categories |
export_all_locales | boolean | No | false | Export all locales in a single CSV |
Output Format
File: {taxonomy}_export_{timestamp}.csv
Columns:
| Column | Description |
|---|---|
locale | Site locale |
name | Taxonomy display name |
slug | URL-friendly slug |
term_id | WordPress term ID |
count | Number of posts using this taxonomy |
Examples
Export English tags:
locale: en
taxonomy: tags
export_all_locales: false
Export all categories across locales:
taxonomy: categories
export_all_locales: true
Sample Output
locale,name,slug,term_id,count
en,Technology,technology,123,45
en,Science,science,124,32
fr,Technologie,technologie,125,28
ExportMediaTask
Class: Maintenance::Wordpress::ExportMediaTask
Export WordPress media library to an Excel file with metadata and copyright information.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
locale | string | Conditional | - | WordPress site locale (required unless exporting all) |
export_all_locales | boolean | No | false | Export all locales (separate worksheet per locale) |
Output Format
File: media_export_{timestamp}.xlsx
Columns:
| Column | Description |
|---|---|
| ID | WordPress attachment ID |
| Created At | Upload date/time |
| Width | Image width in pixels |
| Height | Image height in pixels |
| URL | Direct link to media file (clickable hyperlink) |
| Title | Media title |
| Caption | Media caption |
| Description | Media description |
| Copyright | Copyright holder information |
| Copyright URL | Link to copyright source |
Features
- Multiple worksheets: When exporting all locales, each locale gets its own worksheet
- Hyperlinks: URLs are clickable in Excel
- Parallel processing: Copyright information is fetched in parallel (40 threads) for performance
- Formatted headers: Professional styling for header row
Examples
Export French media:
locale: fr
export_all_locales: false
Export media for all locales:
export_all_locales: true
Performance Notes
The media export uses parallel threads to fetch copyright metadata:
Parallel.each_with_index(media_ids, in_threads: 40) do |attachment_id, idx|
credits = WordpressAPI.site_for(locale).credits(attachment_id)
# Update Excel cells
end
For large media libraries (10,000+ items), the export may take several minutes.
ExportArticlesTask
Class: Maintenance::Wordpress::ExportArticlesTask
Export WordPress articles by category to an Excel file.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
locale | string | Yes | fr | WordPress site locale |
category_slug | string | Yes | mode-de-vie | Category slug to filter articles |
Output Format
File: articles_export_{locale}_{timestamp}.xlsx
Columns:
| Column | Description |
|---|---|
| Title | Article title (clickable hyperlink to article) |
| Post ID | WordPress post ID |
| URL | Direct link to article |
Features
- Hyperlinks: Article titles link directly to the article URL
- Category filtering: Only exports articles in the specified category
- Locale-specific: Targets a single WordPress site
Examples
Export French lifestyle articles (defaults):
locale: fr
category_slug: mode-de-vie
Export Italian news articles:
locale: it
category_slug: notizie
Export English features:
locale: en
category_slug: features
Sample Output
The Excel file contains a single "Articles" worksheet:
| Title | Post ID | URL |
|---|---|---|
| Sample Article | 12345 | https://example.com/article |
Retrieving Export Files
All export files are attached to the user who ran the task. Files can be accessed through:
- User files section in the admin panel
- Direct download after task completion
File Naming Convention
| Task | Filename Pattern |
|---|---|
| ExportTaxonomyTask | {taxonomy}_export_{YYYYMMDD}_{HHMMSS}.csv |
| ExportMediaTask | media_export_{YYYYMMDD}_{HHMMSS}.xlsx |
| ExportArticlesTask | articles_export_{locale}_{YYYYMMDD}_{HHMMSS}.xlsx |
MIME Types
| Format | Content Type |
|---|---|
| CSV | text/csv |
| Excel | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
Related Tasks
- Taxonomy Management Tasks - Use exported taxonomy CSV for bulk operations