Disable share buttons on a shortcode embedded in a page
-
Hello,
Is there any way to get the
addtoany_sharing_disabled
filter to reach custom post types that are generated inside a page by a shortcode?Here is my setup. I am using a plugin that creates a custom post type via a shortcode. The plugin is Arconix FAQ, which creates FAQ custom post types using the
[faq]
shortcode.I want the AddToAny share buttons to appear on the FAQ custom post type, when it is a standalone post (not embedded in a page). However, when I embed the
[faq]
shortcode in a page, I do not want the AddToAny share buttons to show on the FAQs that are output by the[faq]
shortcode.I am using the
addtoany_sharing_disabled
filter to try to achieve this. Below is what I have tried:function lanwt_disable_sharing_on_faqs_in_archive() { global $post; if ( is_page() && has_shortcode( $post->post_content, 'faq' ) ) { return true; } }
add_filter( 'addtoany_sharing_disabled', 'lanwt_disable_sharing_on_faqs_in_archive' );
However, this disables the AddToAny share buttons on the page within which the FAQ custom post types are output by the shortcode, but it does not disable the AddToAny share buttons on the custom post types themselves.
I have been working on this for days and am stumped. Is there any way to get the
addtoany_sharing_disabled
filter to reach custom post types that are generated inside of a page by a shortcode?Thank you for any help.
- The topic ‘Disable share buttons on a shortcode embedded in a page’ is closed to new replies.