If you don't see WordPress native function suggestions in your IDE, it's likely due to incomplete PHP include path configuration. Here's how to configure the main IDEs to resolve this issue.
- Go to
File > Settings(Windows/Linux) orPhpStorm > Settings(macOS) - Navigate to
PHPconfiguration - Click on the
Include Pathtab - Add the following paths using the
+button:public/cmsvendor
- Click
ApplythenOK - Restart PhpStorm for changes to take effect
- Open Settings with
Ctrl+,(Windows/Linux) orCmd+,(macOS) - Search for "php include path"
- Under
PHP > Include Path, add the following paths:{ "php.includePath": [ "./public/cms", "./vendor" ] } - Restart VS Code for changes to take effect
- Paths should be relative to your project root
- After any include path modifications, it's recommended to restart your IDE
- If you're using specific PHP plugins in VS Code (like PHP Intelephense), you might need to configure include paths in their respective settings as well
To verify the configuration is correct:
- Open a PHP file in your project
- Try using a WordPress native function (e.g.,
get_post()) - Autocomplete should now suggest the function and display its documentation
If suggestions still don't appear, verify that:
- Include paths are correctly written
- Your IDE has been restarted
- Your IDE's PHP plugins are up to date