I have a plugin which adds the method to "the_content" filter.
add_filter('the_content', 'myFilteringFunction', 10000);
Within that function I want to add some links on the beginning and the end of the content. But I only need to do it for the "main" content of the displayed page so - not in the any of the widgets, not in the footer, header etc.
Moreover I only want it to be included for the custom post type which I defined in the same plugin. So I figured out that kind of check, thinking it would be enough.
if( is_single() && get_query_var('post_type') == 'myCustomPostType' && is_main_query() )
Unfortunately it's not working as intended - at least not in every case.
On the page the plugin WP Types is installed, it's not working (the links are added despite the condition). Why?