Advanced Ads removes custom meta boxes on the ad edit screen. This is needed, because sometimes, plugin authors forgot to specify that their particular meta box is only meant for publish post types, like posts and pages. Users then might have seen an SEO-related box on the ad pages, which neither worked nor made sense.

If you are a developer and know what you are doing then it might still be needed to have a few custom fields in a meta box on the ad edit page.

With the following code in the functions.php file of your theme, you can whitelist a meta box with the ID my-meta-box.

add_filter( 'advanced-ads-ad-edit-allowed-metaboxes', 'my_advanced_ads_whitelist_meta_box');
function my_advanced_ads_whitelist_meta_box( $meta_boxes ){
    $meta_boxes[] = "my-meta-box"; // ID of the meta box
    return $meta_boxes;
}

Finding the meta box ID is the tough task here. It is normally given where the meta box was registered. You can also find it in the source code of the displayed meta box, when you see it also on another post type.

Allowing an Advanced Custom Fields (ACF) meta box on an ad edit page

The popular Advanced Custom Fields plugin allows you to add custom fields in a meta box on the ad edit page.

The difficulty is to find the meta box ID because it is generated dynamically. On the Edit Field Group page in ACF, just open the Screen Options at the top right and enable Slug. This should display a field like below on the ACF edit page.

Advanced Custom Fields Slug field

Just add the acf- prefix and you have the meta box ID, e.g. group_5c24d33c7da03 becomes acf-group_5c24d33c7da03.

The following code shows how to whitelist this meta box.

add_filter( 'advanced-ads-ad-edit-allowed-metaboxes', 'my_advanced_ads_whitelist_meta_box');
function my_advanced_ads_whitelist_meta_box( $meta_boxes ){
    $meta_boxes[] = "acf-group_5c24d33c7da03";
    return $meta_boxes;
}

 

 Code-Snippets