This hook in the WP Maps Pro plugin allows developers to filter which registered post types display the WP Maps Pro meta box on add or edit screens. It’s triggered when the meta boxes are being set up for the post types.
Usage
Developers can implement this hook in their theme’s functions.php file or a custom plugin. It allows you to customize the post types that should display the WP Maps Pro meta box by modifying the array of post types.
Example 1
This example shows how to display the WP Maps Pro meta box only on ‘page’ post types.
add_filter('wpgmp_meta_box_post_types', function($screens) { return ['page']; });
Example 2
This example demonstrates how to add a custom post type ‘portfolio’ to the list of post types that display the WP Maps Pro meta box.
add_filter('wpgmp_meta_box_post_types', function($screens) { $screens[] = 'portfolio'; return $screens; });
Example 3
In this example, we remove the WP Maps Pro meta box from the ‘post’ post type, leaving it on other default and custom types.
add_filter('wpgmp_meta_box_post_types', function($screens) { return array_filter($screens, function($screen) { return $screen !== 'post'; }); });
Tip: Always ensure the post types you specify are registered and available to prevent issues with the meta box display. Test changes in a staging environment before deployment.