1

Some code I'm looking at from a Plugin contains this line

add_settings_section("section", "Settings", null, "theme-options");

which has a null callback.

Having looked at https://codex.wordpress.org/Function_Reference/add_settings_section it says

$callback - (string) (required) Function that fills the section with the desired content. The function should echo its output.

So, why is this null and what are the implications?

2

$callback = NULL means there is the $callback variable but it has no the value.

In this case, unless you add any setting fields by add_setting_field() and register those settings by register_setting(), you'll get the Settings subheader on the Settings page without any content in this section.

Here is an old tutorial which can be useful to show what I'm talking about. See the third screenshot and the code above it.

Also:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.