AdvancedCustomFields / AdvancedCustomFields/acf

Custom Post Type `menu_order` always set to 0 when saving as JSON

Open
#878 6 comments 0 reactions 0 assignees View on GitHub

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:

  1. Go to Post Types
  2. Create new Post Type, and set custom Menu Order under the Advanced > Visibility tab
  3. Save via filter or manually export JSON on Tools page
  4. See menu_order is 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.