AdvancedCustomFields / AdvancedCustomFields/acf
Custom Post Type `menu_order` always set to 0 when saving as JSON
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 945
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Whether manually exporting as JSON, or using the acf/settings/save_json filter, menu_order always reverts to 0
To Reproduce
Steps to reproduce the behavior:
- Go to
Post Types - Create new Post Type, and set custom Menu Order under the Advanced > Visibility tab
- Save via filter or manually export JSON on
Toolspage - See
menu_orderis 0, although UI reflects correct value
Expected behavior
JSON Should 100% reflect what's stored in the database.
Code
Straightforward filter usage based on docs:
$ACF_CUSTOM_SAVE_PATH = './acf-settings';
function acf_save_json($path)
{
global $ACF_CUSTOM_SAVE_PATH;
return get_stylesheet_directory() . $ACF_CUSTOM_SAVE_PATH;
}
Version Information:
- WordPress Version: 6.3.1
- PHP Version: 8.0.30
- ACF Version: 6.2.1.1
- Browser: N/A
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue from the Post Types UI by setting a custom Menu Order, then save through the Tools page and through the acf/settings/save_json filter. Compare the stored value with the exported JSON and verify that the custom post type's menu_order is preserved rather than becoming 0.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100