ACF: Fields in Custom Table

plugin banner

Stores ACF custom fields in a custom table instead of WordPress core meta tables.

Author:Eduardo Marcolino (profile at wordpress.org)
WordPress version required:4.9.0
WordPress version tested:5.7.2
Plugin version:0.5
Added to WordPress repository:26-11-2020
Last updated:26-05-2021
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
Rating, %:100
Rated by:2
Plugin URI:
Total downloads:2 578
Active installs:100+
plugin download
Click to start download

This ACF plugin makes it possible to store ACF data in structured database tables instead of WordPress core meta tables.

It uses ACF’s acf/update_field_group hook to create/update the database and then uses acf/save_post hook to store the data.

It was heavily inspired by Austin Ginder’s post https://anchor.host/acf-custom-fields-stored-in-custom-table/.

You can contribute to this plugin by submit PR/Issue in https://github.com/eduardo-marcolino/acf-fields-in-custom-table.

Supported Fields

  • Text
  • Text Area
  • Number
  • Range
  • Email
  • URL
  • Password
  • Image
  • File
  • Wysiwyg Editor
  • oEmbed
  • Select
  • Checkbox
  • Radio Button
  • Button Group
  • True / False
  • Date Picker
  • Date Time Picker
  • Time Picker
  • Color Picker
  • Link
  • Post Object
  • Page Link
  • Relationship
  • Taxonomy
  • User

Relational Fields

This plugin supports the following relational field types: Post Object, Page Link, Relationship, Taxonomy and User.

It can store both single and multiple values based on the multiple option.

  • If it’s a single value field, then the column type will be bigint(20) unsigned
  • If it’s a multiple value field, then the column type will be longtext and the date will be stored in json format.

You can query relational fields with multiple values using using MySQL’s function JSON_CONTAINS.
Here is an example:

Table:

+---------+-------------------+--------+
| post_id |       title       | stores |
+---------+-------------------+--------+
|       1 | Lord of the Flies | [1,2]  |
|       2 | The Island        | [2]    |
|       3 | 1984              | [3]    |
+---------+-------------------+--------+

Query:

SELECT * FROM wp_acf_books WHERE JSON_CONTAINS(stores, 2, '$')

The query above will return “Lord of the Flies” and “The Island”.

ACF Compatibility

This plugin was tested with ACF 5 FREE Version .


Screenshots
FAQ
ChangeLog