General hooks
This section covers hooks aimed to improve your Modern Fields experience as developer and site creator.
Change the display value of a field
modern-fields/get_field/value
Since: 1.1.0
Functions like get_field() and the_field() retrieve the raw meta value, but you can change that with this filter.
You can also set the name of the field directly in the field name:
Change the minimum role to access Modern Fields
modern-fields/permissions
Since: 1.0.2
By default, only administrators or user with manage_options capability can access Modern Fields admin pages.
To change that, use the permission hook:
Remove blocks from field group editor
modern-fields/blocks/disabled_blocks
Since: 1.0.0
Disable unwanted blocks in the field group editor. Check the full core blocks list on the official WordPress documentation.
By default, Modern Fields already filters most of the useless blocks in the fields context.
Add a new menu to Modern Fields admin pages
modern-fields/admin/nav_items
Since: 1.0.2
Adds a menu entry on the Modern Fields admin pages. This hook is useful for add-on creators.
Provide the WordPress page slug as defined in add_menu_page function.
Send additional data to block editor
modern-fields/admin/script_data
Since: 1.0.2
Send additional data from PHP to modernFields JS global in the editor.
Hooks for add-ons
This section cover all the hooks useful for creating a Modern Fields add-on.
Register a screen in Modern fields settings
modern-fields/admin/menu_tabs
Since: 1.1.0
This PHP filters allows you to register a new screen along with a menu entry the Modern Fields settings.