I am creating a WordPress plugin that needs to have two dependencies: Contact Form 7 and Advanced Custom Fields.
I am trying to use the new Plugin Dependencies introduced in WP 6.5: https://make.wordpress.org/core/2024/03/05/introducing-plugin-dependencies-in-wordpress-6-5/
I have added the following code to the plugin header:
Requires Plugins: contact-form-7, advanced-custom-fields
I have also added the following filter so that I can use the plugin with ACF Pro
add_filter( 'wp_plugin_dependencies_slug', 'content_download_convert_acf_to_acf_pro' );
function content_download_convert_acf_to_acf_pro( $slug ) {
if ( 'advanced-custom-fields' === $slug ) {
$slug = 'advanced-custom-fields-pro';
}
return $slug;
}
It worked as expected, even if I have CF7 and ACF Pro installed. However, it doesn't allow me to ACTIVATE the plugin until I have the normal ACF installed, even though I have PRO. What am I doing wrong?