Plugin Filters - mcguffin/acf-quickedit-fields GitHub Wiki

Filters

Filter field type support

  • Filter name: acf_quick_edit_fields_types
  • Parameter: $fields
    An associative array of field type support having the ACF field name as keys and an array of supported fetaures as values.
    Features are 'column', 'quickedit' and 'bulkedit'.

Specifying which field groups to display

  • Filter name: acf_quick_edit_fields_group_filter
  • Parameter: $conditions
    Field group conditions passed to acf_get_field_groups()

Number of images in a Gallery Column

  • Filter name: acf_quick_edit_fields_gallery_col_max_images
  • Parameter: $max_images
    Maximum Number of images
    Default: 15

Render a quick edit input or not

  • Filter name: acf_quick_edit_render_{$field_type}
  • Parameter: $render
    Default: true
  • Parameter: $acf_field
  • Parameter: $post_type

Make a column sortable

  • Filter name: acf_quick_edit_sortable_column_{$field_name}
  • Parameter: $sortable
    Default: Whatever is_sortable() on the specific field type returns.

Return false to suppress sortability for the a specific field.
Return a value_type like numeric or datetime if you desire a specific typecasting. See WP_Meta_Query::__construct for a list of available types. By returning true the meta value will not be casted to any type. The native Database sorting for the meta_value column type (which is LONGTEXT) will be applied instead.

Examples

Let's assume there is an ACF number field named size. Sorting is numeric by default:

| Post ID | size   |
|---------|--------|
| 89      | NULL   |
| 155     | -9     |
| 123     | 1      |
| 456     | 2      |
| 789     | 3      |
| 812     | 10     |
| 890     | 11     |

Sort by absolute numeric value:

add_filter( 'acf_quick_edit_sortable_column_size', function( $sort ){
    return 'unsigned';
});

Result:

| Post ID | size   |
|---------|--------|
| 89      | NULL   |
| 123     | 1      |
| 456     | 2      |
| 789     | 3      |
| 155     | -9     |
| 812     | 10     |
| 890     | 11     |

… or alphabetically:

// will fall back to default database sorting:
add_filter( 'acf_quick_edit_sortable_column_size', '__return_true' );

// same result, but more specific:
add_filter( 'acf_quick_edit_sortable_column_size', function( $sort ){
    return 'CHAR';
});

Result

| Post ID | size   |
|---------|--------|
| 89      | NULL   |
| 155     | -9     |
| 123     | 1      |
| 812     | 10     |
| 890     | 11     |
| 456     | 2      |
| 789     | 3      |

Actions

Before render quick/bulk edit Element

  • Action name: acf_quick_edit_field_{$field_type}
  • Parameter: $acf_field
  • Parameter: $post_type