See “How can I programmatically remove the button(s)?” in the plugin’s FAQ:
https://ww.wp.xz.cn/plugins/add-to-any/faq/
Thread Starter
Quibby
(@quibby)
Thank you, micropat.
I am trying to disable for ad listings under a particular ad category/subcategory, I suppose I should be looking at How to disable sharing on custom post type? Only because I tried the disable sharing on categories and that didn’t work for me; is it because the categories here are for categories in blog posts? So if my post type is ad_listing, and I like to disable only for all the ad listings from a subcategory ‘private_collection’ under the category ‘collectibles’, how could I do that?
Thanks!
If it’s a custom post type, there should be a checkbox for that post type under “Placement” in AddToAny settings.
Thread Starter
Quibby
(@quibby)
Thanks… I tried that too but then it turns off the sharing for all the ad listings, all types… I would like to turn it off for only some selected categories or subcategories from among the list of other categories for the ad listing posts. For example, a user can post an ad in one of several categories, A/B/C/D etc, and say I like all the ads to have sharing except for the category D, is there a way to turn if off for this category D only?
In that case, do it programmatically per the FAQ. Something like this in your theme’s functions.php:
function addtoany_disable_sharing_for_ads_in_some_category() {
if ( in_category( array( 'private_collection' ) ) && 'ad_listing' == get_post_type() ) {
return true;
}
}
add_filter( 'addtoany_sharing_disabled', 'addtoany_disable_sharing_for_ads_in_some_category' );