Skip to content

Protect GatherPress meta from Custom Fields panel to prevent stale data overwrites.#1383

Merged
mauteri merged 6 commits intomainfrom
protected-meta
Feb 16, 2026
Merged

Protect GatherPress meta from Custom Fields panel to prevent stale data overwrites.#1383
mauteri merged 6 commits intomainfrom
protected-meta

Conversation

@mauteri
Copy link
Copy Markdown
Contributor

@mauteri mauteri commented Feb 15, 2026

Description of the Change

When Custom Fields are enabled in the block editor, saving an event triggers two saves - one from JavaScript with updated data, then one from the Custom Fields metabox with stale data loaded at page load. This overwrites datetime changes.

Fix: Mark all gatherpress_ meta keys as protected so they don't appear in Custom Fields.

How to test the Change

  1. Edit an event or venue and open Preferences (⋮ menu → Preferences)
  2. Enable "Custom Fields" under Panels
  3. Change the event end time and save
  4. Reload the page — the end time change should persist
  5. Verify gatherpress_* fields don't appear in Custom Fields panel

Changelog Entry

Fixed - Bug fix

Credits

Props @mauteri @carstingaxion

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 15, 2026

✅ WordPress Plugin Check Report

✅ Status: Passed

📊 Report

All checks passed! No errors or warnings found.


🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

@mauteri mauteri marked this pull request as ready for review February 15, 2026 17:16
@mauteri mauteri changed the title Protect event meta from Custom Fields panel to prevent stale data overwrites. Protect GatherPress meta from Custom Fields panel to prevent stale data overwrites. Feb 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Preview changes with Playground

You can preview the recent changes for PR#1383 with the following PHP versions:

PHP Version 8.4

PHP Version 8.2

PHP Version 7.4

Download .zip with build changes

Made with 💙 from GatherPress & a little bit of WordPress Playground. Changes will not persist between sessions.

Copy link
Copy Markdown
Collaborator

@carstingaxion carstingaxion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the used by section for this filter, makes me wonder if this is maybe to rigid, to protect all "gatherpress_" meta fields.

But in general, I absolutely like the way, this looks clean and straightforward.

@mauteri
Copy link
Copy Markdown
Contributor Author

mauteri commented Feb 15, 2026

Looking at the used by section for this filter, makes me wonder if this is maybe to rigid, to protect all "gatherpress_" meta fields.

But in general, I absolutely like the way, this looks clean and straightforward.

I was thinking about that too, but in the end, I can't think of a meta field we'd put out that'd we'd want people to use the Custom Fields metaboxes or any other alternative ways to make changes to; we'd always want our UI to make changes to our meta fields. This also makes us not have to manage any new meta fields and adding it to a list.

If it becomes too much of an issue, we can always extend it with a filter to bypass some gatherpress_* meta, but make it opt-in to bypass it.

@mauteri mauteri merged commit ce2d012 into main Feb 16, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants