How to avoid errors due to not having the specific functions of wordpress inside the projet when making a Wordpress Theme on Visual Studio Code ?
Is there a plugin to download ?
How to avoid errors due to not having the specific functions of wordpress inside the projet when making a Wordpress Theme on Visual Studio Code ?
Is there a plugin to download ?
Wordpress stubs are included in In VSCode.
You just need to activate it.
If you follow these steps your errors will disapear.
Now all the error should disapear.
If not, try to restart VSCode.
You can try using WordPress Stubs https://github.com/php-stubs/wordpress-stubs. The easy way is download this file https://raw.githubusercontent.com/php-stubs/wordpress-stubs/master/wordpress-stubs.php (Wordpress v5.8.1) and paste in your theme.
Open VS Code in the root of the WordPress installation.
You get this error because you are referring to functions that are not in your open files in your editor.
If you follow these steps your errors will disappear.
Click on gear icon > Select settings > Search for stubs > Scroll down an click on 'Add item' > select WordPress > Hit ok