• Resolved dgr8saurav

    (@dgr8saurav)


    Hello,
    I am trying to modify the query arguments before the listing is displayed.
    I am using this filter ‘get_job_listings_query_args’.
    Now in plugin code this filter uses 2 arguments.
    From the plugin:
    $query_args = apply_filters( 'get_job_listings_query_args', $query_args, $args );

    My code:

    add_filter( 'get_job_listings_query_args', 'test_func2');
    function test_func2($query_args, $args){
        return $query_args;
    }

    But when I use it in my theme’s function file it gives me this error:
    ‘PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function test_func2(), 1 passed in /wordpress/core/5.3.2/wp-includes/class-wp-hook.php on line 290 and exactly 2 expected in functions.php:688’

    And when I try with just 1 argument $query_args, it works fine. But I need to use other argument too.
    Can anyone help?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Hook Argument Error (get_job_listings_query_args)’ is closed to new replies.