Make WordPress Core

Opened 13 months ago

Closed 13 months ago

Last modified 13 months ago

#58425 closed enhancement (wontfix)

Use wp_die in place of only die in `WP_Widget::widget()`

Reported by: shakhari's profile shakhari Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.2.2
Component: Widgets Keywords:
Focuses: Cc:


I am reading class-wp-widget.php and suddenly I have found a regular php die function where as WordPress have it's own wp_die functions and WordPress code sniffers always recommended to use wp_die.

Function name: public function widget

Change History (3)

#1 follow-up: @swissspidy
13 months ago

  • Keywords changes-requested removed
  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed
  • Summary changed from Use wp_die in place of only die to Use wp_die in place of only die in `WP_Widget::widget()`

Hello and welcome to WordPress Trac!

This die() call in WP_Widget::widget() is meant as a warning for developers that they need to extend the method in their subclass. Nowadays such a class method would be declared as abstract, but for historical reasons that is not the case here.

Since it's a message meant for developers and not end users, there isn't really a need to use wp_die() here just because a linter says so.

#2 @Presskopp
13 months ago

duplicate of #58420

#3 in reply to: ↑ 1 @shakhari
13 months ago

Hello @swissspidy
Thanks for the clarifications regarding the topic.


Note: See TracTickets for help on using tickets.