We provide the code snippets and content on this page without any guarantee or support. In most cases, these pages are created on requests or based on individual solutions sent to us by other users. After it was published, we are only reviewing the code and content when we are made aware of an issue. Please let us know if you find one.
Please only use the codes if you understand them and know how to add custom code to your WordPress site.
Developers can turn off the Ad Settings meta box on post or page edit screens using the code below.
/**
* Remove Ad Settings meta box from post edit screens
*
* @param string $post_type current post type.
*/
function advads_remove_post_meta_boxes( $post_type = '' ) {
remove_meta_box( 'advads-ad-settings', $post_type, 'side' );
};
add_action( 'add_meta_boxes', 'advads_remove_post_meta_boxes', 11 );
Code language: PHP (php)
Please note that this will remove the box for all users but still preserve the settings. Before using the code above, make sure that you disabled any checkboxes. Developers can also remove all _advads_ad_settings
post meta keys from the post_meta
table to reset the Ad Settings to default.
You can use the following SQL query to reset all Ad Settings that disable ads at your own risk:
DELETE FROM wp_postmeta WHERE meta_key = '_advads_ad_settings' AND meta_value LIKE '%"disable_ads";i:1;%'
Code language: SQL (Structured Query Language) (sql)
If you only want to hide the meta box for yourself then open the block editor options > Options > Advanced panels and disable the Ad Settings option.