I added some shortcode after the content using filter, like this:

add_filter( 'the_content', 'image_posts' );

but now that I run has_shortcode in another function, this returns false even though the shortcode is there (which was added using the above filter.

if ( has_shortcode( $content, 'gallery' ) ) {
   // return false 

how can I test the has_shortcode for contents added using add_filter?

Read more here: has_shortcode for content added after the content


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: