Allows posts and pages to be archived so you can unpublish content without having to trash it.
Contributors: joshuadavidnelson, fjarrett
Minimum PHP version supported: 8.1
Tested up to PHP version: 8.3
Minimum WP Version supported: 5.9
Tested up to WP version: 6.6.2
Stable tag: 0.3.11
License: GPL-2.0
This plugin allows you to archive your WordPress content similar to the way you archive your e-mail.
- Unpublish your posts and pages without having to trash them
- Archive content is hidden from public view
- Compatible with posts, pages, and public custom post types
- Ideal for sites where certain kinds of content is not meant to be evergreen
- Easily extended (see below)
Over 13 languages supported
Pull requests welcome, please follow these guidelines.
Please see issues reported there before going to the plugin forum.
Did you find this plugin helpful? Please consider leaving a 5-star review.
Actually, no, they are not the same thing.
The Draft status is a "pre-published" status that is reserved for content that is still being worked on. You can still make changes to content marked as Draft, and you can preview your changes.
The Private status is a special kind of published status. It means the content is published, but only certain logged-in users can view it.
The Archived post status, on the other hand, is meant to be a "post-published" status. Once a post has been set to Archived it can no longer be edited or viewed.
Of course, you can always change the status back to Draft or Publish if you want to be able to edit its content again.
Yes, there is nothing wong with trashing old content. And the behavior of the Archived status is very similar to that of trashing.
However, WordPress permanently deletes trashed posts after 30 days (see here).
This is what makes the Archived post status handy. You can unpublish content without having to delete it forever.
This plugin does not have a settings page. However, there are numerous hooks available in the plugin so you can customize default behaviors. Many of those hooks are listed below in this FAQ.
This is most likely because you are viewing your site while being logged in as an Editor or Administrator.
By default, any user with the read_private_posts
capability will see Archived posts appear on the front-end of your site.
You can change the default read capability by adding this hook to your theme's functions.php
file or as an MU plugin:
function my_aps_default_read_capability( $capability ) {
$capability = 'read';
return $capability;
}
add_filter( 'aps_default_read_capability', 'my_aps_default_read_capability' );
Yes, add these hooks to your theme's functions.php
file or as an MU plugin:
add_filter( 'aps_status_arg_public', '__return_true' );
add_filter( 'aps_status_arg_private', '__return_false' );
add_filter( 'aps_status_arg_exclude_from_search', '__return_false' );
You can change the post status name, the "Archived" string, by adding the code snippet to your theme's functions.php
file or as an MU plugin:
add_filter( 'aps_archived_label_string', function( $label ) {
$label = 'Custom Label'; // replace with your custom label
return $label;
});
This will change the name used in the admin and on the post title label (see below).
This plugin automatically adds Archived:
to the title of archived content. (Note that archived content is only viewable to logged in users with the read_private_posts
capability).
You can modify the label text, the separator, whether it appears before or after the title, or disable it entirely.
Follow the examples below, adding the code snippet to your theme's functions.php
file or as an MU plugin.
add_filter( 'aps_title_label', '__return_false' );
add_filter( 'aps_title_label_before', '__return_false' );
The separator is the string between the "Archived" label and the post title, including spaces. When the label appears before the title, the separator is a colon and space :
, if the label is placed after the title it is a dash with spaces on each side -
.
You can customize the separator with the following filter:
add_filter( 'aps_title_separator', function( $sep ) {
$sep = ' ~ '; // replace with your separator
return $sep;
});
Can I make Archived posts hidden from the "All" list in the WP Admin, similar to Trashed posts?
Add these hooks to your theme's functions.php
file or as an MU plugin:
add_filter( 'aps_status_arg_public', '__return_false' );
add_filter( 'aps_status_arg_private', '__return_false' );
add_filter( 'aps_status_arg_show_in_admin_all_list', '__return_false' );
Please note that there is a bug in core that requires public and private to be set to false in order for the aps_status_arg_show_in_admin_all_list
to also be false.
Add this hook to your theme's functions.php
file or as an MU plugin:
function my_aps_excluded_post_types( $post_types ) {
$post_types[] = 'my_custom_post_type';
return $post_types;
}
add_filter( 'aps_excluded_post_types', 'my_aps_excluded_post_types' );
Don't worry, your content is not gone it's just inaccessible. Unfortunately, using a custom post status like archive
is only going to work while the plugin is active.
If you have archived content and deactivate or delete this plugin, that content will disappear from view. Your content is in the database - WordPress just no longer recognizes the post_status
because this plugin is not there to set this post status up.
If you no longer need the plugin but want to retain your archived content:
- Activate this plugin
- Switch all the archived posts/pages/post types to a native post status, like 'draft' or 'publish'
- THEN deactivate/delete the plugin.
All contributions are welcomed and considered, please refer to contributing.md.
All pull requests should be directed at the develop
branch, and will be reviewed prior to merging. No pull requests will be merged with failing tests, but it's okay if you don't initially pass tests. Please create a draft pull request for proof of concept code or changes you'd like to have input on prior to review.
Please make on a branch specific to a single issue or feature. For instance, if you are suggest a solution to an issue, please create fork with a branch like issue-894
. Or if you are proposing a new feature, create a fork with the branch name indicating the feature like feature-example-bananas
All improvements are merged into develop
and then queued up for release before being merged into stable
. Releases are deployed via github actions to wordpress.org on tagging a new release.
The stable
branch is reserved for releases and intended to be a mirror of the official current release, or trunk
on wordpress.org.
The develop
branch is the most current working branch. Please direct all pull requests to the develop
branch
Requirements:
- Docker
- Node Package Manager (npm)
This repo contains the files needed to boot up a local development environment using wp-env.
Run npm install
and the npm run env:start
to boot up a local environment.