WordPress.org

Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#7846 closed defect (bug) (wontfix)

do_action and apply_filter should report if the user function is missing

Reported by: nbachiyski Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:
PR Number:

Description

do_action/apply_filters tell me somehow that I the user function doesn't exists. For example I have entered the action name wrong and there is no proper way to debug it other from luck and guessing.

Fixing do_action is easy -- it can just return false or WP_Error. The problem is with apply_filters -- it's return value is dependent on the user function and we can't interfere with it in no way.

Change History (3)

#1 @DD32
11 years ago

You can call has_filter() to check if a function has been registered for a filter/action hook, Infact, calling that will require less code than checking for a error condition being returned.

#2 @Viper007Bond
11 years ago

Suggest wontfix. 99.9% of the time it doesn't matter if a filter/hook actually does anything or not. For those times that it does, has_filter() is a simple way to test.

#3 @ryan
11 years ago

  • Milestone 2.8 deleted
  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.