How to get shortcode to work inside a foreach loop called within a shortcode?

The issue is you are echoing raw post_content field from object. It isn’t what usually gets to front-end. Try:

apply_filters( 'the_content', $post->post_content )

If you want to run shortcodes alone (without bunch of other filters) you can do:

do_shortcode( $post->post_content )

Edit re-read your question… Is there a possibility that this thing gets recursive? Post containing slider shortocde that calls itself?

Leave a Comment