I literally got used to Visual Studio code highlighting function names from WordPress core when working in environments that don’t include the WordPress Core files. Quite disturbing actually – especially when you have code sniffers setup and follow WordPress Coding Standards.
Well, today I noticed it again and did some research. Apparently, there’s an easy fix!
The Easy Fix
When you have PHP Intelephense installed (and if you don’t have it, go get it), this is what you need to:
- Go to Preferences -> Settings
- Open Extensions -> Intelephense
- Scroll all the way down to “Stubs” (it’s a large list, can’t miss it)
- Click “Add Item”
- Press “W” for WordPress, or scroll down the list untill you find it.
- Select WordPress and click “OK”
- Close your settings
That’s it!
Happy developing!
Do you mean ‘Stubs’, on line 3?
I’ll have to double check next Monday. Unless.. can you confirm it says Stubs?
It’s definitely stubs and not subs… and you came up 3rd for me when I searched how to fix this… Also, it sort of works for me, all the red errors are gone but they are now replaced with orange warnings… any idea how to solve that?
Thanks, I corrected it now! Hmm, not sure about the orange warnings, can you share some more information?
It worked 100% fine for me 🙂 thanks
Thanks man,
Just getting started with wordpress and all these warnings were really annoying.
I can imagine, have fun in WordPress development!
That worked for me! Thank you!
Klasse, ich habe lange nach einer so einfachen Erklärung/Anleitung gesucht. Funktioniert einwandfrei. Danke dafür
Graag gedaan!