• Is there any way for a plugin filter function to detect when the_content is being called within a post or page only?

    For instance, when the_excerpt_rss() is called from another plugin or theme, it also calls the_content so my filter gets loaded.

    The problem is that my filter should only run when the_content is actually outputting the content (in full) on the page.

    Is there any way to detect this, or possible workarounds?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter micropat

    (@micropat)

    This would obviously not be a good idea to use in the plugin, but iterating through debug_backtrace() came to mind as a possible technical option.

    Anything else come to mind?

    I read in a nettuts tutorial that you can use

    return (is_single()) ? $variableName

    at the end of your plugin to return the filtered text only when the post is viewed in full. Hope that helps.

    Thread Starter micropat

    (@micropat)

    Hi Migweld, thanks for trying to help. 🙂 Unfortunately the filter needs to function on the front page as well, not just single pages.

    Other ideas?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Filter the_content only when outputting full content?’ is closed to new replies.