can I pass arguments to my function through add_action?

后端 未结 13 2164
慢半拍i
慢半拍i 2020-11-29 01:07

can I do something like that? to pass arguments to my function? I already studied add_action doc but did not figure out how to do it. What the exact syntax to pass two argum

13条回答
  •  温柔的废话
    2020-11-29 01:11

    Pass in vars from the local scope FIRST, then pass the fn SECOND:

    $fn = function() use($pollId){ 
       echo "

    NO POLLS FOUND FOR POLL ID $pollId

    "; }; add_action('admin_notices', $fn);

提交回复
热议问题