This guide highlights the primary extension points for developers who want to customize ArchiveWP or integrate archived content into their own workflows.
Templates & Theme Integration
Classic Themes
- Archived posts use your theme’s single template (
single.php/singular.php). ArchiveWP injects the disclaimer notice at the beginning of the content viaFrontend::add_archive_notice(). - Archive Category taxonomy pages reuse your theme’s archive template. In classic themes,
Frontend::add_archive_category_disclaimer()outputs the disclaimer just after the loop starts. - To adjust the disclaimer markup, use the filters outlined below or call the renderer directly.
To reposition the disclaimer, you can suppress the default markup with CSS or filters and output your own message via \EqualizeDigital\ArchiveWP\Frontend\Helpers::output_archived_content_message() inside the desired template hook.
Block Themes
- ArchiveWP includes a block template override:
templates/block-templates/taxonomy-edawp_archive_category.html. - WordPress automatically loads the template when a block theme is active. Editors can customize it via Appearance → Editor → Templates → Archive Category.
- The template includes the disclaimer block, Query Title, Term Description, and the Archive Loop block.
To override the plugin-provided template, place a file with the same slug (taxonomy-edawp_archive_category.html) inside your theme’s templates/ directory.
Disclaimer Customization
Modify the default disclaimer text by navigating to Settings → ArchiveWP → General. For programmatic changes, use:
edawp_archived_content_message– filter the full disclaimer message before output.archivewp_archived_content_message_classes– adjust the wrapper classes (defaults includearchivewp-disclaimer).archivewp_archived_content_date_markup– alter or remove the appended date string.
Example — add a custom CSS class:
add_filter(
'archivewp_archived_content_message_classes',
static function ( $classes ) {
$classes[] = 'my-org-archive-notice';
return $classes;
}
);
Working with Archived Content Programmatically
Archiving Posts
use EqualizeDigital\ArchiveWP\Backend\Archive\ArchiveService;
$post_id = 123;
$result = ArchiveService::move_post_to_archive( $post_id );
if ( ! $result ) {
// Handle failure (post type not permitted, error updating, etc.).
}
- The service records the original post type (
_edawp_original_post_type), archive date (_edawp_archived_date), original permalink, and taxonomy relationships. - Hook into the
edawp_post_archivedaction to run follow-up tasks:
add_action(
'edawp_post_archived',
static function ( $post_id, $original_post_type ) {
// Trigger custom logging or notification.
},
10,
2
);
Restoring Posts
use EqualizeDigital\ArchiveWP\Backend\Archive\RestoreService;
$result = RestoreService::restore_post( $archived_post_id );
if ( is_wp_error( $result ) ) {
// Inspect $result->get_error_message() for details.
}
- After restoration the service removes ArchiveWP-specific metadata and reassigns any captured taxonomy terms.
- Listen to the
edawp_post_restoredaction for notifications.
Querying Archived Records
edawp_archived is a public post type without a global archive route. Query it like any other post type:
$query = new \WP_Query( [
'post_type' => 'edawp_archived',
'posts_per_page' => 20,
'paged' => max( 1, get_query_var( 'paged' ) ),
'orderby' => 'date',
'order' => 'DESC',
] );
Use the helper classes documented in docs/archive-rendering-classes.md to output the filter form and loop in templates or custom endpoints.
CLI Utilities
ArchiveWP registers WP-CLI commands (see WP-CLI Commands documentation):
wp archivewp migrate-posts <id> [<id> ...]wp archivewp restore-posts <id> [<id> ...]wp archivewp restore-defaultswp archivewp reset-wizard
These commands wrap the same services described above and respect the plugin settings.
Hook Reference (Quick Links)
- Actions:
edawp_post_archived,edawp_post_restored,edawp_license_tab,edawp_first_time_configuration_tab. - Filters (selected):
edawp_archivable_post_types— extend the list of archivable post types.edawp_preserve_taxonomy_relationships— prevent taxonomy migration for specific cases.archivewp_category_pills_html,archivewp_read_more_html,archivewp_post_dates_html— adjust loop markup.edawp_template_cache_duration— change how long block templates remain cached.
Refer to the hook reference for full signatures and file locations.
