Hooks, Filters, and Actions
This document outlins all the plugin filters and actions.
Use these to modify the plugin behavior and customize it's functionality.
Filters
aps_archived_label_string
aps_archived_label_stringFilters the label used throughout the plugin for archived content.
Since: 0.3.9
Parameters:
string $label- The "Archived" label (default: "Archived")
Returns: string
Example:
add_filter( 'aps_archived_label_string', function( $label ) {
return 'Archived Content';
} );aps_title_label
aps_title_labelFilters the label that appears in archived post titles on the frontend.
Since: 0.3.9
Parameters:
string $label- The label text for archived posts (default: result ofaps_archived_label_string())int $post_id- The post IDstring $title- The post title
Returns: string
Example:
aps_title_label_before
aps_title_label_beforeControls whether the archived label appears before or after the post title.
Since: 0.3.9
Parameters:
bool $before- True to place before the title, false to place after (default:true)int $post_id- The post ID
Returns: bool
Example:
aps_title_separator
aps_title_separatorFilters the separator used between the archived label and post title.
Since: 0.3.9
Parameters:
string $sep- The separator string (default: ": " when before, " - " when after)int $post_id- The post ID
Returns: string
Example:
aps_excluded_post_types
aps_excluded_post_typesFilters the post types that should not support the archived status.
Since: 0.1.0
Parameters:
array $post_types- Array of post type slugs to exclude (default:['attachment'])
Returns: array
Example:
aps_supported_post_types
aps_supported_post_typesFilters the post types that can use the archived post status.
Since: 0.4.0
Parameters:
array $post_types- Array of supported post type slugs
Returns: array
Example:
Status Argument Filters
These filters control the behavior of the archived post status registration:
aps_status_arg_public
aps_status_arg_publicControls whether archived posts are public.
Since: 0.4.0
Parameters:
bool $public- True to make public (default:!is_admin() && aps_current_user_can_view())
Returns: bool
aps_status_arg_private
aps_status_arg_privateControls whether archived posts are private.
Since: 0.4.0
Parameters:
bool $private- True to make private (default:!is_admin())
Returns: bool
aps_status_arg_protected
aps_status_arg_protectedControls whether archived posts are protected.
Since: 0.4.0
Parameters:
bool $protected- True to make protected (default:false)
Returns: bool
aps_status_arg_exclude_from_search
aps_status_arg_exclude_from_searchControls whether archived posts are excluded from search.
Since: 0.4.0
Parameters:
bool $exclude- True to exclude from search (default:!(is_admin() && aps_current_user_can_view()))
Returns: bool
aps_status_arg_show_in_admin_all_list
aps_status_arg_show_in_admin_all_listControls whether archived posts appear in the admin "All" list.
Since: 0.4.0
Parameters:
bool $show- True to show in admin all list (default:false)
Returns: bool
aps_status_arg_show_in_admin_status_list
aps_status_arg_show_in_admin_status_listControls whether archived posts appear in the admin status list.
Since: 0.4.0
Parameters:
bool $show- True to show in admin status list (default:aps_current_user_can_view())
Returns: bool
aps_status_arg_dashicon
aps_status_arg_dashiconFilters the dashicon used for archived posts in the admin.
Since: 0.4.0
Parameters:
string $icon- The dashicon name (default: "dashicons-archive")
Returns: string
Example:
Capability Filters
aps_default_read_capability
aps_default_read_capabilityFilters the capability required to view archived content.
Since: 0.3.0
Parameters:
string $capability- The capability name (default: "read_private_posts")int $post_id- The post ID
Returns: string
Example:
aps_default_archive_capability
aps_default_archive_capabilityFilters the capability required to archive content.
Since: 0.4.0
Parameters:
string $capability- The capability name (default: "edit_others_posts")int $post_id- The post ID
Returns: string
aps_user_unarchive_capability
aps_user_unarchive_capabilityFilters the capability required to unarchive content.
Since: 0.4.0
Parameters:
string $capability- The capability name (default: "edit_others_posts")int $post_id- The post ID
Returns: string
Link Filters
aps_get_archive_post_link
aps_get_archive_post_linkFilters the URL for archiving a post.
Since: 0.4.0
Parameters:
string $link- The archive link URLint $post_id- The post IDstring $context- The link context (default: 'display')
Returns: string
aps_get_unarchive_post_link
aps_get_unarchive_post_linkFilters the URL for unarchiving a post.
Since: 0.4.0
Parameters:
string $link- The unarchive link URLint $post_id- The post IDstring $context- The link context (default: 'display')
Returns: string
aps_archived_post_link
aps_archived_post_linkFilters the URL used to view an archived post.
Since: 0.4.0
Parameters:
string $archived_link- The archived post URLWP_Post $post- The post object
Returns: string
Archive/Unarchive Process Filters
aps_pre_archive_post
aps_pre_archive_postFilters whether a post archiving should take place.
Since: 0.4.0
Parameters:
bool|null $archive- Whether to proceed with archiving (default:null)WP_Post $post- The post objectstring $previous_status- The post's previous status
Returns: bool|null - Return non-null to short-circuit the archiving process
aps_pre_unarchive_post
aps_pre_unarchive_postFilters whether a post unarchiving should take place.
Since: 0.4.0
Parameters:
bool|null $unarchive- Whether to proceed with unarchiving (default:null)WP_Post $post- The post objectstring $previous_status- The post's previous status
Returns: bool|null - Return non-null to short-circuit the unarchiving process
aps_unarchive_post_status
aps_unarchive_post_statusFilters the status assigned to a post when restored from archive.
Since: 0.4.0
Parameters:
string $new_status- The new status (default: previous status)int $post_id- The post IDstring $previous_status- The status at archiving time
Returns: string
aps_unarchive_post_comment_status
aps_unarchive_post_comment_statusFilters the comment status assigned when a post is restored from archive.
Since: 0.4.0
Parameters:
string $comment_status- The comment status (default: stored value)int $post_id- The post IDstring $previous_status- The status at archiving time
Returns: string
aps_unarchive_post_ping_status
aps_unarchive_post_ping_statusFilters the ping status assigned when a post is restored from archive.
Since: 0.4.0
Parameters:
string $ping_status- The ping status (default: stored value)int $post_id- The post IDstring $previous_status- The status at archiving time
Returns: string
aps_archivable_statuses
aps_archivable_statusesFilters which post statuses can be archived.
Since: 0.4.0
Parameters:
array $statuses- Array of archivable status names (default:['publish', 'future', 'draft', 'pending', 'private'])
Returns: array
aps_is_read_only
aps_is_read_onlyFilters whether archived content is read-only.
Since: 0.3.5
Parameters:
bool $is_read_only- True if read-only (default:true)
Returns: bool
Feature Toggle Filters
Each feature class in the plugin can be toggled using a dynamic filter:
aps_{feature_name}
aps_{feature_name}Toggles individual plugin features on or off.
Since: 0.4.0
Parameters:
bool $active- True if feature is active (default:true)
Returns: bool
Available Features:
aps_admin_notices- Admin notices featureaps_archived_title- Title modification featureaps_bulk_edit- Bulk edit functionalityaps_post_editor- Post editor enhancementsaps_row_actions- Post list row actionsaps_save_post- Save post functionality
Example:
Actions
Plugin Lifecycle Actions
aps_init
aps_initFires when the plugin is initialized, before anything is loaded.
Since: 0.4.0
Parameters: None
Example:
aps_loaded
aps_loadedFires when the plugin is loaded, after all dependencies are loaded.
Since: 0.4.0
Parameters: None
Example:
Archive/Unarchive Actions
aps_archive_post
aps_archive_postFires before a post is archived.
Since: 0.4.0
Parameters:
int $post_id- The post IDstring $previous_status- The post's status before archiving
Example:
aps_archived_post
aps_archived_postFires after a post is archived.
Since: 0.4.0
Parameters:
int $post_id- The post IDstring $previous_status- The post's status before archiving
aps_unarchive_post
aps_unarchive_postFires before a post is unarchived.
Since: 0.4.0
Parameters:
int $post_id- The post IDstring $previous_status- The post's status before unarchiving
aps_unarchived_post
aps_unarchived_postFires after a post is unarchived.
Since: 0.4.0
Parameters:
int $post_id- The post IDstring $previous_status- The post's status before unarchiving
Usage Examples
Custom Post Type Support
Change Label on Archived Content
Last updated