Make WordPress Core

Opened 4 years ago

Last modified 2 years ago

#28463 new feature request

Need core concept of the first publication of a post/comment.

Reported by: andy Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: dev-feedback needs-patch
Focuses: Cc:


Because status transitions are permitted to occur in a cyclic fashion, it is possible to publish a post/comment more than once. The first publication event has unique significance, e.g. to push-based subscription delivery systems, but this concept is not represented anywhere in WordPress.

Restricting status transitions to a directed acyclic graph is a non-starter.

What I have done in plugins (and Nacin also suggests) is to mark the initial publication in meta: if transitioning to publish/approved, try adding the meta; if the add succeeds, this is the initial publication. I suspect that a significant number of plugins duplicate this.

It would be even more useful to keep the history of changes to post_status in revisions rather than put "inherit" in that field. This would have repercussions in the already complex system for revisions, which has no facility for dealing with changes to non-content fields. It may also conflict with the existing uses of the "inherit" status, such as calling get_post_status() on a revision with the intention of getting the parent's status.

Status revisions may have other uses as well (see #23314, #12706) but comment revisions don't exist yet. Ultimately what I want is a hook that fires only on the initial publication of a post or comment. The add_post_meta/add_comment_meta system can accomplish this much more easily.

Change History (4)

#1 @DrewAPicture
4 years ago

  • Type changed from defect (bug) to enhancement

#2 @DrewAPicture
3 years ago

  • Component changed from General to Posts, Post Types
  • Keywords dev-feedback added
  • Type changed from enhancement to feature request

#3 @chriscct7
2 years ago

  • Keywords needs-patch added

This ticket was mentioned in Slack in #core by swissspidy. View the logs.

2 years ago

Note: See TracTickets for help on using tickets.