Marinus Klasen

Marinus Klasen

  • Development
  • Consultancy
  • Developer Resources
  • Blog
  • Contact

November 8, 2021

VS Code showing errors for functions in WordPress core?

Marinus Klasen

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:

  1. Go to Preferences -> Settings
  2. Open Extensions -> Intelephense
  3. Scroll all the way down to “Stubs” (it’s a large list, can’t miss it)
  4. Click “Add Item”
  5. Press “W” for WordPress, or scroll down the list untill you find it.
  6. Select WordPress and click “OK”
  7. Close your settings

That’s it!

Happy developing!

About Marinus Klasen

Marinus has been working in software/web development for more than a decade. Since 2020 his attention shifted on sharing knowledge and developing products and tools for sharing knowledge.

Marinus Klasen on Twitter

This site runs on Cloudways.
It's fast isn't it?
Cloudways offers high-quality, fast and affordable hosting.

Learn more

Need a hand? Post your project and hire me and other top notch developers on Codeable.

Hire me on Codeable

Comments

  1. Chandan says

    October 1, 2022 at 2:05 pm

    Do you mean ‘Stubs’, on line 3?

    Reply
    • Marinus Klasen says

      October 1, 2022 at 6:35 pm

      I’ll have to double check next Monday. Unless.. can you confirm it says Stubs?

      Reply
      • Kevin says

        January 28, 2023 at 4:35 am

        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?

        Reply
        • Marinus Klasen says

          February 3, 2023 at 12:29 pm

          Thanks, I corrected it now! Hmm, not sure about the orange warnings, can you share some more information?

          Reply
  2. Martin says

    February 13, 2023 at 11:22 am

    It worked 100% fine for me 🙂 thanks

    Reply
  3. Joel says

    March 7, 2023 at 11:40 pm

    Thanks man,

    Just getting started with wordpress and all these warnings were really annoying.

    Reply
    • Marinus Klasen says

      March 22, 2023 at 12:47 pm

      I can imagine, have fun in WordPress development!

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Ready to take action?

I'm looking forward to discuss your projects and goals!
Feel free to reach out using the contact details below.

Marinus Klasen

[email protected]
twitter.com/marinusklasen
linkedin.com/in/marinusklasen

  • GitHub
  • LinkedIn
  • Twitter

Have you read?

  • Storing private data with SSH on WPEngine sitesDecember 15, 2022
  • Get the HTML content of a block edit page or post in WordPressNovember 30, 2022
  • Rename Coupon code text to Discount code in WoocommerceNovember 3, 2022
  • Background-size cover in mPDFOctober 22, 2022
  • WordPress.com SSH & duplicating a WordPress.com website locallyOctober 11, 2022

Copyright © 2023 · Marinus Klasen | Webdesign by Team Rood