Add Created, Created by, Last edited, Last edited by columns#38
Merged
Conversation
WP core stores when a post was last modified, but not who. A save_post hook on entry CPTs records the current user ID. Skipped when no user is signed in, so CLI and cron writes don't overwrite the real editor with 0.
`format_row` emits `created_at` and `modified_at` as RFC3339 UTC plus the resolved display names for `created_by` and `modified_by`. A one-shot `cache_users` prime keeps name lookup at two queries regardless of row count. `validate_fields` splits into sort-context and filter-context helpers so `created_at` and `modified_at` can be sorted but no system field is silently routed through `meta_query` as a filter. Sort branches map `created_at` to `orderby: 'date'` and `modified_at` to `orderby: 'modified'`.
Appends four system fields to `useCollectionFields` with `editable: false` (PR A's seed effect leaves them default-hidden) and `enableSorting` only on the timestamps. Cells render plain spans, not EditableCell, so they're never editable in place. Sort on the `_by` columns is deferred to RSM-1793 alongside relations and rollups: stored value is a user ID, useful sort is on the displayed name, and the same shape applies to all display-value properties. Tech debt entries cover that, plus `_modified_by` being plugin-stored and system-field filtering being deferred.
`wp_insert_post` defaults `post_author` to `get_current_user_id()`, which is 0 in CLI context, so seeded entries had no author. Set the current user to the first administrator at the start of the seed so seeded rows demo the Created by / Last edited by columns instead of showing empty cells.
priethor
added a commit
that referenced
this pull request
May 1, 2026
WordPress runs the_title filter on title.rendered (wptexturize, HTML entity encoding), which converts & to & and similar. JSX auto-escapes text children, so the entity makes it through the render verbatim and the column header reads 'Date & time' instead of 'Date & time'. Prefer title.raw, which carries the unfiltered string.
priethor
added a commit
that referenced
this pull request
May 1, 2026
The Title column's getValue still preferred title.rendered, which WordPress runs through the_title (encoding & as & among other substitutions). That made sort comparisons sort by the literal entity. mapField was already fixed; this brings TITLE_FIELD in line. Also adds a unit test asserting mapField returns the raw title for the column label, so a future refactor can't silently flip the preference back.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Part of #99
Adds
Created,Created by,Last edited, andLast edited byas read-only columns. Default-hidden, addable from the column visibility menu.Why
The block didn't expose who created or last edited a row.
How
save_posthook on entry CPTs writes_modified_bypost meta. Skipped when no user is signed in, so CLI and cron writes don't clobber it with 0.format_rowreturns the four keys (RFC3339 UTC timestamps and resolved display names).cache_usersprimes once per page so name lookup stays at two queries regardless of row count.validate_fieldssplits into sort-context and filter-context helpers; without the split, a filter oncreated_atwould no-op throughmeta_query.Testing
wp cortext seed --reset --force._bycolumns expose no sort.wp post update <id> --post_title="cli edit".Last edited bystays at the previous editor.