• Resolved dlt101

    (@dlt101)


    Sorry for not understanding this. I keep getting this error:

    Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given

    Apparently it is because $item is undefined. Below is the sample on the plugin page:
    But what is $item supposed to be ????

    ———————————–
    function my_new_menu_conditions($conditions) {
    $conditions[] = array(
    ‘id’ => ‘single-my-custom-post-type’,
    ‘name’ => __(‘Single my-custom-post-type’, ‘i18n-domain’),
    ‘condition’ => function($item) {
    return is_singular(‘my-custom-post-type’);
    }
    );

    return $conditions;
    }
    ———————————————————

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter dlt101

    (@dlt101)

    function my_new_menu_conditions($conditions) {
    $conditions[] = array(
    ‘id’ => ‘single-my-custom-post-type’,
    ‘name’ => __(‘Single my-custom-post-type’, ‘i18n-domain’),
    ‘condition’ => function($item) {
    return is_singular(‘my-custom-post-type’);
    }
    );
    
    return $conditions;
    }
    Thread Starter dlt101

    (@dlt101)

    Reposted

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Syntax Error’ is closed to new replies.