Skip to content
get_field has cost in front end! it means when you perform this function it calls multiple time queries as you store data in your backend. in simple words if you had 1000 text box in your acf option back-end and you call acf get_field in front-end it will call mysql query 1000 times and if you want use acf and care about your performance you wil…
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets
LICENSE
README.md
index.php

README.md

ACF getallobjects

FOR DEVELOPERS Only!

get_field has cost in front end! it means when you perform this function it calls multiple time queries as you store data in your backend. in simple words if you had 1000 text box in your acf option back-end and you call acf get_field in front-end it will call mysql query 1000 times and if you want use acf and care about your performance you will need to use this plugin or other approciate approche.

Before use this plugin

alt tag

After use this plugin

alt tag

How is work?

After save acf in backend this plugin create record in Database(wp_options) with this pattern (acfAllObjects+post_id) as key and put all your fields data as whole object in value. then you instead of get_fields('foo', 'option') you can use ACFAllObj::get('foo', 'option');

How to Use?

  1. Clone or Download in your plugins directory
$ git clone https://github.com/devlifeX/acf-getallobjects.git
  1. Activate plugin from wp-admin
  2. Go to your acf post type (option or custom post type etc...) and save again (for create acfAllObjects record)
  3. Go to your theme file and replace your current code with this structure
 if (class_exists('ACFAllObj')) {   
        $foo = ACFAllObj::get('foo', 'option');
        $bar = ACFAllObj::get('bar', 'option');
    } else {
        $foo = get_field('foo', 'option');
        $bar = get_field('bar', 'option');
    }
You can’t perform that action at this time.