Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#21630 closed defect (bug) (fixed)

Calling add_settings_section() without callback function throws notices

Reported by: lightningspirit's profile lightningspirit Owned by: ryan's profile ryan
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.4.1
Component: Administration Keywords: has-patch commit
Focuses: Cc:


Calling add_settings_section() without a callback function should be possible, since a lot of settings section don't need *anything* special between the <h3> tags and the input settings.

This patch aloows people to call without providing a custom function for that purpose.

Changind do_settings_section().

Attachments (1)

template.patch (637 bytes) - added by lightningspirit 12 years ago.

Download all attachments as: .zip

Change History (5)

#1 @obenland
12 years ago

One might as well just pass '__return_false'.

#2 @lightningspirit
12 years ago

Although those functions can be used anywhere, in my opinion their purpose is to be used in the core mainly.

__return_false, __return_true, __return_zero and __return_empty_array are not so well-known, besides there are no codex entry for them...

If you can pass false to register_post_type *callbacks* and a lot of other functions why not here too? It's just to make things easier for developers.

#3 @nacin
12 years ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 3.5

The __return methods are designed for plugin usage, in particular as callbacks. Mainly for actions and filters, but this works too.

I usually pass __return_false here as well, but I also find it to be lame, and agree with this patch.

#4 @ryan
12 years ago

  • Owner set to ryan
  • Resolution set to fixed
  • Status changed from new to closed

In [21742]:

Make the callback optional for add_settings_section(). Props lightningspirit. fixes #21630

Note: See TracTickets for help on using tickets.