Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#21630 closed defect (bug) (fixed)

Calling add_settings_section() without callback function throws notices

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

Description

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 14 years ago.

Download all attachments as: .zip

Change History (5)

#1 @obenland
14 years ago

One might as well just pass '__return_false'.

#2 @lightningspirit
14 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
14 years ago

  • Keywords commit added
  • Milestone Awaiting Review3.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
14 years ago

  • Owner set to ryan
  • Resolutionfixed
  • Status newclosed

In [21742]:

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

Note: See TracTickets for help on using tickets.