I am creating a function in wordpress function.php, but I am getting an error:
Missing argument 2 for get_appcara_child() in C:\wamp\www\appcara\wp-content\themes\appkara\functions.php on line 617
The function is giving the correct output, but I don't know why it is displaying this warning
My function.php is
add_action( 'init', 'get_appcara_child',2 );
function get_appcara_child($post,$parent)
{
echo $post;
echo $parent;
}
Calling at page.php
$child= get_appcara_child($post->ID , $post->post_parent);
$post->post_parentalways set?add_action()does Wordpress not call the function at some point (probably at initialization)? If so, are you sure Wordpress gives it two arguments? If not then you should look into that. Have you read the documentation thoroughly?