Skip to content

Conversation

@priethor
Copy link
Contributor

What

Fixes the update post ability to require the ID, preventing the creation of new posts instead.

Why

Previously, the ability required either an ID, a key, or a slug. However, the internal acf_update_post_type creates a new post if not provided with the ID it needs to update, so updates could result in new posts.

How

  • Schema change: Modified register_update_post_type_ability() to use get_post_type_with_internal_fields_schema() with only ID marked as required, making all other fields optional.
  • Callback enhancement: Updated update_post_type_callback() to merge incoming input with existing post type data, ensuring that only specified fields are updated while preserving original values for the rest.

@priethor priethor self-assigned this Nov 14, 2025
@priethor priethor added the [Type] Bug Something isn't working label Nov 14, 2025
@github-actions
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props priethor.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@codecov
Copy link

codecov bot commented Nov 14, 2025

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 1.17%. Comparing base (e870b55) to head (513a6d6).
⚠️ Report is 1 commits behind head on trunk.

Files with missing lines Patch % Lines
...cludes/abilities/class-scf-post-type-abilities.php 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             trunk    #239      +/-   ##
==========================================
- Coverage     1.17%   1.17%   -0.01%     
  Complexity    4416    4416              
==========================================
  Files          261     261              
  Lines        27017   27021       +4     
==========================================
  Hits           318     318              
- Misses       26699   26703       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@priethor
Copy link
Contributor Author

I'll go ahead and merge this despite the codecov flag because I still need to push the e2e tests for abilities and configure codecov uploads from e2e tests.

@priethor priethor merged commit 035790c into trunk Nov 14, 2025
8 of 9 checks passed
@priethor priethor deleted the fix/update-ability-require-id branch November 14, 2025 11:10
@cbravobernal cbravobernal added this to the 6.6.0 milestone Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants