Skip to main content

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

ParameterTypeRequiredDefaultDescription
localestringConditional-WordPress site locale (required unless exporting all)
taxonomystringYestagsEither tags or categories
export_all_localesbooleanNofalseExport all locales in a single CSV

Output Format

File: {taxonomy}_export_{timestamp}.csv

Columns:

ColumnDescription
localeSite locale
nameTaxonomy display name
slugURL-friendly slug
term_idWordPress term ID
countNumber 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

ParameterTypeRequiredDefaultDescription
localestringConditional-WordPress site locale (required unless exporting all)
export_all_localesbooleanNofalseExport all locales (separate worksheet per locale)

Output Format

File: media_export_{timestamp}.xlsx

Columns:

ColumnDescription
IDWordPress attachment ID
Created AtUpload date/time
WidthImage width in pixels
HeightImage height in pixels
URLDirect link to media file (clickable hyperlink)
TitleMedia title
CaptionMedia caption
DescriptionMedia description
CopyrightCopyright holder information
Copyright URLLink 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

ParameterTypeRequiredDefaultDescription
localestringYesfrWordPress site locale
category_slugstringYesmode-de-vieCategory slug to filter articles

Output Format

File: articles_export_{locale}_{timestamp}.xlsx

Columns:

ColumnDescription
TitleArticle title (clickable hyperlink to article)
Post IDWordPress post ID
URLDirect 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:

TitlePost IDURL
Sample Article12345https://example.com/article

Retrieving Export Files

All export files are attached to the user who ran the task. Files can be accessed through:

  1. User files section in the admin panel
  2. Direct download after task completion

File Naming Convention

TaskFilename Pattern
ExportTaxonomyTask{taxonomy}_export_{YYYYMMDD}_{HHMMSS}.csv
ExportMediaTaskmedia_export_{YYYYMMDD}_{HHMMSS}.xlsx
ExportArticlesTaskarticles_export_{locale}_{YYYYMMDD}_{HHMMSS}.xlsx

MIME Types

FormatContent Type
CSVtext/csv
Excelapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet