4

I'm using PHPStorm while develop WordPress plugins (mainly for HTML/CSS/JS).

Each plugin is a separate PHPStorm project since I can have several goodies from using this way.

The issue is when working on a plugin, the WordPress functions like _e are marked as Warnings (yellow color) and the information PHPStorm gives is that

"Undefined function _e"

How can I configure PHPStorm that it understand the WordPress functions and do not shows that errors and autocomplete the functions without to have a big project wrapping the WordPress installation?

4

1 回答 1

8

您需要以某种方式引用 WordPress 代码。几种可能的方法:

  1. 添加为外部库- 仅适用于参考:Settings | PHP | Include paths
  2. 添加为项目本身的一部分(小心,因为在这种情况下,将在搜索/重构/等操作期间使用 WP 代码)-Settings | Directories | Add Content Root
  3. 项目中某处的符号链接(但对于您的情况,#2 仍然更好)
于 2013-07-26T22:59:40.167 回答