Running custom actions after a table value is updated

You may use the acfcdt/custom_table_value_updated action hook to run custom functionality after a field value has been saved in a custom database table. A common use case could be to delete core meta table values as they are saved in a custom table. e.g; add_action( ‘acfcdt/custom_table_value_updated’, function ( $value, $post_id, $field_array ) { // Delete […]

Phil Kurth Phil Kurth

Overriding default field value encode and decode behaviours

When storing a value in a database table, the value cannot be an array or object as these will result in database errors. To protect against this, WordPress’ core meta system attempts to serialize all values before storing them in the core tables. This allows us to pass non-scalar values (arrays, objects) to functions such […]

Want it delivered fresh? You know what to do…

We never share your data.
Read our Privacy Policy

Preventing deletion of custom table data

By default, the plugin will intercept calls made to delete posts and remove all custom table data when the post is removed from the database. Note: Moving a post to the trash does not trigger data removal from custom database tables. This only occurs when the post is removed permanently from the database via the […]

Globally activate sub tables

It is possible to set a global setting that will enable sub tables on all eligible fields. At the time of writing, the only fields eligible for sub tables are repeaters. We don’t recommend this as you will have a very large number of database tables but, if you need to, you can use the […]

Empty value handling

When deleting a field value from a custom database table — either by passing an empty value to update_field() or by invoking delete_field() — the data type must be considered to ensure the table column receives the correct ’empty’ value. This is especially true when controlling column data types for maximum efficiency. For example, a […]

Filtering values before insertion

You may use the acfcdt/filter_value_before_update filter to modify values before they are stored in custom database tables. The filter runs after ACF’s core acf/update_value filter and does not affect values stored in core meta tables — this purely provides a way to manipulate data stored in custom tables only. If you need to modify data […]

Controlling column data types

As of version 1.1, it is possible to control the data types of custom database table columns. Controlling the type can be useful in reducing your database size and increasing the efficiency of your queries. It’s important to note, due to the way databases work, changing the data types on an existing database may result […]

Disabling fields for a particular table

If you need to prevent fields from generating columns on a particular table, you can use the following filter: * Filtering the array of supported fields for a given table. This affects table * definition generation and can go in your functions.php file or a plugin. */ add_filter( ‘acfcdt/field_group_supported_fields’, function ( $supported_fields, $table_name ) { […]

Disabling storage or retrieval to and from custom database tables

A collection of action hooks can be fired to disable/enable data intercept handlers when necessary. Once disabled, data will not be intercepted until re-enabled. You may fire these actions once for a global effect should you need to. How to disable data retrieval from custom database tables Disables the get field intercept do_action(‘acfcdt/disable_get_field_intercept’); // Data […]

Activating support for a custom field type

If you are using custom ACF field types and wish to store their values in a custom database table, you need to register the field type as supported. You can do so using the following: * This will register a custom field type as supported by the plugin. * This affects table definition generation and […]

Good dev stuff, delivered.

Product news, tips, and other cool things we make.

We never share your data. Read our Privacy Policy

© 2016 – 2024 Hookturn Digital. All rights reserved.