最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

core - Isn't requiring a file before it's loaded by WordPress itself a symptom of bad code?

programmeradmin1浏览0评论
Closed. This question is opinion-based. It is not currently accepting answers.

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 5 years ago.

Improve this question

There's a lot of if( !function_exists(... { require ABSPATH . '/file.php in the industry. We didn't crash, the world still lives, yet I wonder - isn't this one of the worst things you can do in an event driven system like WordPress is?

At first sight, you're just including classes / functions that do nothing by the require alone, ye? Wrong. If you need to require a file, you also plan on using a function. Inside that function, there could be do_action that should only fire once and at the right time, yet you're firing them here. What if a critical piece of code relies on that action to fire at a certain moment when a resource is available?

Then, shouldn't we have a lot of errors in the eco-system?

What am I misunderstanding here? To me, in theory, this seems like you open yourself to so many fatal errors doing this, yet we're all fine.

发布评论

评论列表(0)

  1. 暂无评论