Hooks & Filters

Discover how you can customize your Modern Fields experience with hooks and filters.

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:

PHP

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.

PHP

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.

PHP

Provide the WordPress page slug as defined in add_menu_page function.

Change the minimum role to access Modern Fields

modern-fields/admin/script_data

Since : 1.0.2

Send additional data to modernFields global in front end, to use with JS.

PHP