Forums

Passing a parameter to filter and action functions (1 post)

  1. jackmn
    Member
    Posted 1 year ago #

    Hi,

    I am developing a plugin and would like to ask whether there is a way to pass my own parameters to the function in add_filter or add_action.
    For example take a look in the following code:

    function my_content($content)
    {
    do something...
    return $content;
    }
    add_filter('the_content', 'my_content', 10, 1)

    Can I pass my own parameter? something like:
    add_filter('the_content', 'my_content($my_param)', 10, 1)
    or
    add_filter('the_content', 'my_content', 10, 1, $my_param)

Topic Closed

This topic has been closed to new replies.

About this Topic