• Hello!

    I want to place filter for comment_reply_link data flow. OK, setup it:
    <?php add_filter('comment_reply_link', 'comment_reply_link_filter',99); ?>
    Now, according to Plugin API/Filter Reference:

    comment_reply_link … Filter function arguments: link (string), custom options (array), current comment (object), current post (object).

    Indeed, in comment-template.php file we can see:

    function get_comment_reply_link(...) {...
    return apply_filters('comment_reply_link', $before . $link . $after, $args, $comment, $post);}

    Four arguments sended to filter, as you see.
    So, my hook comment_reply_link_filter can expect all these 4 arguments as it’s input:

    function comment_reply_link_filter(){
    $numargs = func_num_args();
    echo "Number of arguments: $numargs<br />\n";
    if ($numargs >= 1) {
             echo "1st argument is: " . htmlspecialchars(func_get_arg(0)) . "<br />\n";
         }
    if ($numargs >= 2) {
             echo "2nd argument is: " . func_get_arg(1) . "<br />\n";
         }
    if ($numargs >= 3) {
             echo "3th argument is: " . func_get_arg(2) . "<br />\n";
         }
    if ($numargs >= 4) {
             echo "4th argument is: " . func_get_arg(4) . "<br />\n";
         }
    } ?>

    Output of my filter:

    Number of arguments: 1
    1st argument is: (correct_link_here)

    How it can be at all?? Where is another 3 args??

  • The topic ‘Filter on comment_reply_link and missing arguments’ is closed to new replies.