I create a file name custom.php
which is like below:
class customClass{
function dothisfunction( $mobiles , $message ){
//use parameters
}
}
In my function.php
file I add the following code:
$number = '09112223344';
$mymsg = 'nadia is testing';
$myClass = new customClass();
add_action( 'publish_post', array( $myClass ,'dothisfunction', $number, $mymsg ) );
but it returns error, the error is :
PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, array must have exactly two members in C:\xampp\htdocs\wp-includes\class-wp-hook.php on line 288
How can I solve it? Can anyone help me?