Upgrade guide for Admin Columns 7
Version 7 may include breaking changes if you are using our hooks or have created custom columns.
If your setup does not use our hooks or custom columns, no action is needed: you can safely upgrade. The rest of this guide explains what developers need to update to ensure their customizations continue to work.
What has changed?
Admin Columns 7 fundamentally changes how columns are created and managed. If you’ve implemented custom columns or used our hooks in your code, you’ll need to make some changes in your code to ensure compatibility with version 7.
Filters / Actions
To prevent fatal errors, we have removed or updated many column-related hooks. If your code contains any of these hooks, they will trigger a deprecated notice in version 7. You can find these notices under the Help tab in the Admin Columns settings screen. This tab provides developers with migration tools and information to migrate to the new hooks.
The following overview lists all hooks that have been updated, along with links to their current implementation examples:
Replaced Filters
| Removed Filted | Replacement Filter |
|---|---|
| ac/column/value | ac/column/render |
| ac/column/value/sanitize | ac/column/render/sanitize |
| ac/headings/label | ac/column/heading/label |
| ac/export/value | ac/export/render |
| ac/export/value/escape | ac/export/render/escape |
| acp/custom_field/stored_date_format | ac/custom_field/stored_date_format |
| acp/delete/bulk/deleted_rows_per_iteration | ac/delete/bulk/deleted_rows_per_iteration |
| acp/delete/reassign_user | ac/delete/reassign_user |
| acp/editing/bulk/show_confirmation | ac/editing/bulk/show_confirmation |
| acp/editing/bulk/updated_rows_per_iteration | ac/editing/bulk/updated_rows_per_iteration |
| acp/editing/persistent | ac/editing/persistent |
| acp/editing/post_statuses | ac/editing/post_statuses |
| acp/editing/save_value | ac/editing/save_value |
| acp/editing/settings/post_types | ac/editing/custom_field/post_types |
| acp/editing/value | ac/editing/value |
| acp/editing/view | ac/editing/view |
| acp/export/is_active | ac/export/is_active |
| acp/export/file_name | ac/export/file_name |
| acp/filtering/cache/seconds | ac/filtering/cache/seconds |
| acp/resize_columns/active | ac/resize_columns/active |
| acp/search/is_active | ac/search/enable |
| acp/search/filters | ac/search/filters |
| acp/sorting/default | ac/sorting/default |
| acp/sorting/model | ac/sorting/model |
| acp/sorting/remember_last_sorting_preference | ac/sorting/remember_last_sorting_preference |
| acp/sorting/custom_field/date_type | ac/sorting/custom_field/date_type |
| acp/sorting/custom_field/numeric_type | ac/sorting/custom_field/numeric_type |
| acp/quick_add/enable | ac/quick_add/enable |
| acp/wc/column/product/sales/statuses | ac/wc/column/product/sales/statuses |
Removed Filters
| Removed Filter |
|---|
| ac/admin/menu_group |
| ac/column/custom_field/field_types |
| ac/column/separator |
| ac/column_group |
| ac/export/column/disable |
| ac/headings |
| ac/read_only_message |
| ac/show_banner |
| acp/admin/enable_submenu |
| acp/editing/inline/deprecated_style |
| acp/editing/value/column_type |
| acp/editing/view_settings |
| acp/editing/view_settings/$type |
| acp/horizontal_scrolling/enable |
| acp/sorting/post_status |
Replaced Actions
| Removed Filter | Replacement Filter |
|---|---|
| ac/column_types | ac/column/types |
| ac/columns_stored | ac/columns/stored |
| acp/acf/after_get_field_options | ac/acf/after_get_field_options |
| acp/acf/before_get_field_options | ac/acf/before_get_field_options |
| acp/column_types | ac/column/types/pro |
| acp/editing/before_save | ac/editing/before_save |
| acp/editing/saved | ac/editing/saved |
| acp/list_screen/deleted | ac/list_screen/deleted |
| acp/quick_add/saved | ac/quick_add/saved |
Removed Actions
| Old Action |
|---|
| ac/admin/menu_group |
| ac/column/settings |
| ac/list_screen/column_created |
| ac/list_screen_groups |
| ac/settings/after_columns |
| ac/settings/after_title |
| ac/settings/before_columns |
| ac/settings/sidebox |
| acp/admin/settings/hide_on_screen |
Custom Columns
Custom columns are created and registered differently in version 7. Custom columns created prior to version 7 stop working gracefully. Our new template repository on GitHub demonstrates how you can create a new column for version 7: https://github.com/codepress/ac-column-template/tree/refactor
The main changes for registering custom columns are:
- The hook to register a new column is changed to
ac/column/types/pro - Instead of creating a new column, you now write a factory that will create the new column
- Instead of returning a string for the value, you now return a FormatterCollection of Formatters that will construct the value for a record
Feature classes for Sorting, Editing, Export, and Filtering are unchanged; only the way that the features are linked to a column is changed.
Stuck with this? No worries, we will help you! Our support team is available to answer any questions on how to implement the hooks or custom columns in version 7.