WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 14 months ago

#19932 closed enhancement (fixed)

Pass post ID to post revision field filter

Reported by: pollett Owned by: westi
Milestone: 3.6 Priority: normal
Severity: minor Version:
Component: Revisions Keywords: has-patch
Focuses: Cc:

Description

When viewing a post revision, for each field the filter

_wp_post_revision_field_xx

is called. This is passed the field name and value as parameters but not the post ID that it's working with, this allows you to modify the value based on it's currently contents but not based on the post ID i.e. to inject new fields into the diff.

Proposal that the post ID also be passed to this filter rather than having to hack around it by making $left and $right global.

Attachments (3)

revisions.patch (946 bytes) - added by pollett 2 years ago.
Add post ID to revision field filter
revisions-whole.diff (938 bytes) - added by pollett 2 years ago.
Pass complete revision to revision field filter
19932.1.patch (1.2 KB) - added by ethitter 15 months ago.

Download all attachments as: .zip

Change History (10)

pollett2 years ago

Add post ID to revision field filter

comment:1 scribu2 years ago

Why not pass the whole revision instead of just the ID, then?

pollett2 years ago

Pass complete revision to revision field filter

comment:2 pollett2 years ago

Passing the whole revision seems fairly reasonable. Patch added.

comment:3 westi15 months ago

  • Keywords revisions-3.6 added

Adding as a candidate for the Revisions work in 3.6

comment:4 westi15 months ago

  • Keywords revisions-3.6 removed
  • Milestone changed from Awaiting Review to 3.6

ethitter15 months ago

comment:5 ethitter15 months ago

  • Cc erick@… added

In 19932.1.patch, I refreshed the patch and added the entire revision to the third instance of the filter. I also added the revision side to the uses, or an empty string when not in a diff.

comment:6 adamsilverstein15 months ago

  • Cc adamsilverstein@… added

looks good.

comment:7 westi14 months ago

  • Owner set to westi
  • Resolution set to fixed
  • Status changed from new to closed

In 23404:

Revisions: Pass the whole revision being filtered along with context about which side it is to the _wp_post_revision_field_$field filters.

Fixes #19932 props pollett, ethitter.

Note: See TracTickets for help on using tickets.