Support » Plugins » add_filter: How to pass parameters to functions ?

  • So I create a simple plugin to display data via add_filter. I can invoke my php function with add_filter. How can I pass a parameter to my function? One post/page I want to display stats for Red Sox, in another stats for White Sox. I want to call the same function and simply pass a parameter to indicate which stats to display? How? I see in syntax says number of args but how do I pass? Help! Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter j8h9

    (@j8h9)

    Well I am getting the results I want but it doesn’t appear I’m doing it the way I should be.

    I installed php_exceution plugin and then put this into each post and it works.

    938<?php add_filter(“the_content”,”myfunction”);?>

    Basically, my function finds 938, does a database lookup and returns the correct data (based on the id = 938). Am I suppose to be executing add_filter in each post? Is there an easier way to do this?

    Hi…
    you can use this..

    add_filter(‘the_content’,your_function($arg1,$arg2),2);

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘add_filter: How to pass parameters to functions ?’ is closed to new replies.