How to exclude a function from the_content filter in WordPress

First of all for I am sorry for not writing the question correctly. I am not sure how to express this.

Scenario

I’ve created a shortcode which fetches content from another posts by post ID. The following is the shortcode function

function fetch_content_from_posts($atts, $content = null)
{
    global $post;
    extract(shortcode_atts(array(
        'id' => '12345' // post id
    ), $atts));
    ob_start();
    $output = apply_filters('the_content', get_post_field('post_content', $id));
    $output .= ob_get_contents();
    ob_end_clean();
    return $output;
} 

add_shortcode('fetch_content', 'fetch_content_from_posts');

Issue

Another plugin is using the the_content filter and calling a newsletter below the single post pages. Below is the filter from that plugin which is defined in a Class function

add_filter( 'the_content', array( $this, 'display_below_single_post' ), 9999 );

My Problem

When I use the shortcode [fetch_content] in the footer text widget, the newsletter from that plugin is appended in the footer below the fetched content and not in the intended area.

Need solution

How I can fix this? I do not want to append the newsletter function in my shortcode function which is in the footer widget

Read more here: How to exclude a function from the_content filter in WordPress

Leave a Reply

Your email address will not be published. Required fields are marked *