How to pass variable to add_settings_section() callback?

if you look at the do_settings_sections function more specifically the line 1164 where the callback function is being executed :

call_user_func($section['callback'], $section);

you can see that the $section array is being passed to the callback function, so you can identify the callback by the $section['id']

hope this make since.

Update

here is an example, if your add_settings_section callback for all sections was named oenology_hooks_section_callback then you can identify it like this:

function oenology_hooks_section_callback($section_passed){
    if ($section_passed['id'] == 'whatever_section_id'){
        //do stuff
    }
    if ($section_passed['id'] == 'whatever_section_id_number2'){
        //do other stuff
    }
 }

and by do stuff i mean do whatever you want to do with that section callback.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)