Will
Will

Reputation: 1201

What is causing PHP Intelephense v1.7.1 to display Undefined function?

I just installed PHP Intelephense v1.7.1 vscode extension to help with theme development. I am now getting the following errors being displayed. How can I fix this error?

Error being displayed in the code

Upvotes: 2

Views: 2275

Answers (3)

tsolak_
tsolak_

Reputation: 11

In VS Code:

  1. Click on the gear icon at the bottom of your sidebar
  2. Click Settings and search for "stubs"
  3. Click on the Intelephense extension and then scroll down to bottom
  4. Click add new item and then add "wordpress"

Upvotes: 1

Moh .S
Moh .S

Reputation: 2090

Go to VS Code Workspace settings or VS Code Folder settings and look for the Intelephense › Environment: Include Paths setting.

Here click Add Item and enter the path of a Wordpress installation main index.php file like :

"/your/path/to/wordpress/admin/index.php"

or

"/your/path/to/wordpress/index.php"

This will prevent displaying Wordpress functions and constants errors.

Upvotes: 0

WdeVlam
WdeVlam

Reputation: 139

there are a few extensions that help with wordpress development. e.g. 'Wordpress Hooks Intellisense' helps vscode recognize wordpress specific functions.

Upvotes: 2

Related Questions