Digital Sovereignty for everyone

Developer reference

Filters

  • lh_archive_post_status_get_applicable_post_types_filter ( $post_types ): the post type names the archived status applies to. Remove a type here to leave its listings, list table and edit screen untouched. This is the filter to use.
  • lh_archive_post_status_posttypes_filter ( $post_types ): the older name for the same list, applied just before the filter above. Kept for compatibility.
  • lh_archive_post_status_return_doing_their_own_thing_post_types ( $post_types ): post types that manage their own publish box, by default advanced_ads and wc_membership_plan. They’re excluded from the applicable types and from the WP Statuses publish box.
  • lh_archive_post_status_message_filter ( $message, $content ): the Archive Message HTML, after wpautop(), before it’s added to an archived post’s content.
  • lh_archive_post_status_content_filter ( $updated_content, $content ): the archived post’s content with the message prepended. Return something else to change the placement.
  • lh_archive_post_status_get_archive_post_link ( $link, $post ): the one-click archive URL, an admin-ajax request with a nonce that redirects back to the current page.
  • lh_archive_post_status_input_validation ( $output, $input ): the settings array on save.

Template function

archive_post_link( $text = null, $before = '', $after = '', $post = 0, $class = 'post-archive-link' ) echoes an Archive link for a post, like edit_post_link(). It outputs nothing unless the current user can edit the post and its post type is applicable. The anchor tag passes through the archive_post_link filter ( $link, $post_id, $text ). It’s only defined if no other plugin has defined it.

Data and cron

  • Post status: archive.
  • Post meta _lh_archive_post_status-post_expires: the Archive Date, as Y-m-d H:i:s.
  • Option lh_archive_post_status_options: the Reading settings, keys public, lh_archive_post_status-title_label and lh_archive_post_status_message.
  • Cron: lh_archived_post_status_run (hourly, archives expired posts) and lh_archived_post_status_initial (once after activation, sets default settings). Both are scheduled on every site when network-activated, and cleared on deactivation.

Integrations

  • Bundles the WP Statuses library, loaded only if no other copy is present.
  • Relevanssi: archived posts are treated as valid for indexing and results.
  • WP Super Cache and LiteSpeed Cache: when a published item of the post post type is archived, its cache (and the home page, for LiteSpeed) is purged.
  • LocalHero plugins: archived posts are included for lh-wayback-machine and the broken link checker when publicly readable, the Archive Date is not copied by lh-copy-to-draft, and an Archive link is added to the More modal.

If you like this plugin please consider making a donation to further development

Install LHero.org

lhero.org

Open it straight from your home screen, full screen and quicker to load.

  1. Tap the Share button . If you cannot see it, tap ••• first.
  2. Scroll down and tap Add to Home Screen.
  3. Tap Add.
  1. Tap the browser menu â‹®.
  2. Tap Install app or Add to Home screen.
  1. In the menu bar, choose File, then Add to Dock.

Use your browser's menu to install this site or add it to your home screen.