humanmade / humanmade/repeatable-posts

Suggestion: Add unpublish option

Open
#27 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
48
Forks
12
PR merge metrics
No merged PRs in 30d

Description

This may seem like a strange suggestion when reading only the title, but please hear me out :)

For a website i'm (heavily) working on, I have a lot of seasonal relevant posts. Preferably, I would like these posts to only appear when they are in season.

## An example for repeating + unpublishing
Let's say that we have a generic post about Christmas. The post should become visible every year in December (thus repeatable). Since the post isn't relevant the rest of the year it should be unpublished on the first of January (either change from 'published' to 'draft' or 'remove' altogether. Perhaps this implementation can possibly be combined with #5 ?).

I'm curious to hear what others think of this idea (interesting, useless?)

## How could this 'unpublishing' be achieved?
An idea for implementation is as follows:

1. option to set an _unpublish date_ from the admin interface
2. when saving the post, either save OR remove the _unpublish date_ from the post's meta info. Which of these actions is executed is dependent of user input.
3. when the meta info changes, set a [scheduled event](https://codex.wordpress.org/Function_Reference/wp_schedule_event) to unpublish the post, or remove an earlier set scheduled event (if any).

_Extra:
4. upon post delete / restore, trigger action nr. 3._

## ...and repeatable unpublishing?
For repeatable posts, one could hook into the scheduling of the next post, and correct the _unpublish date_ in the meta info with the repeat interval.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.