Support

Account

Home Forums ACF PRO Optimizing Local JSON output by removing defaults

Helping

Optimizing Local JSON output by removing defaults

  • Hi, I’ve sped up our website GREATLY by using local JSON (thanks!) and noticed that https://www.advancedcustomfields.com/resources/register-fields-via-php/ describes that we can remove keys with default values and then “ACF will merge in the missing default settings.”

    Does this apply to https://www.advancedcustomfields.com/resources/local-json/ too?

    So:

    
    "instructions": "",
    "required": 0,
    "conditional_logic": 0,
    "wrapper": {
        "width": "",
        "class": "",
        "id": ""
    },
    "default_value": "",
    "placeholder": "",
    "maxlength": "",
    "rows": "",
    "new_lines": "wpautop",
    "readonly": 0,
    "disabled": 0
    

    could be shortened to:

    
    "new_lines": "wpautop",
    

    TIA,
    Gary

  • I don’t know if it applies, but I don’t think reducing the file size is going to save you more that a millisecond or 4. ACF is using file_get_contents(). I seriously doubt that the size of the file is going to matter much to this function since it’s all happening on the server. According to https://www.raditha.com/wiki/Readfile_vs_include/ it only takes .00564 seconds to read a 1MB file and only .00152 seconds to read a 32KB file.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.