Support » Plugins » Add a Filter Conditionally?

  • Resolved golddave


    I’m writing a plugin that has an option to be called through a template tag or to be called “automatically”. When it is called “automatically” the plugin adds some text after the post. This option is applied using a filter as follows:
    add_filter(‘the_content’, ‘add_some_text’);

    I would like this filter to be conditional so that it doesn’t get run when the option is set to use the template tag but have had trouble setting it up. I have tried to do an if statement (if option is set to automatic) and that has not worked. Can a filter be set conditionally? Or do I need to create two versions of this plugin?


  • The topic ‘Add a Filter Conditionally?’ is closed to new replies.