WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have some layout changes that are being applied to the_content. I need to do one of two things, but neither is working as expected... either:

  1. Pass data to the filter so that it knows if it is a "loop inside a loop" (this pertains to a special post type events that are outputting multiple events on a given page). The problem is that the $post object inside the filter is returning the $post for the PAGE, and not the specific item where the filter is about to be applied, so using post_type will not work. I wonder if this is bad implementation on the part of the plugin author (calling $post->post_content in a non-standard way that is preventing me from accessing it).

  2. The other possibility would be to somehow detect "nested" loops, but the issue I have with this is that the main call to the_content() seems to be the last one firing, and I'm not sure there's a way to track number of times a loop has fired when I don't have public access to the length of that private wp_query() the plugin is executing for it's own post type.

Any thoughts on something to fix this... the issue is very significant since it's trying to embed HTML layout intended only for the main page, inside the inner-loop for events.

share|improve this question
Please include actual code, it is much easier to understand code then prose ;) – Mark Kaplun Dec 16 '13 at 5:40
This should be possible, but the details are not clear. Are you editing a theme template, a plugin? What? And as MarkKaplun requested, include the code. – s_ha_dum Dec 16 '13 at 15:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.