Skip to content

Feature Request: Automatically Index WordPress Plugin Functions in Standard Installations #3285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Mgrmjp opened this issue May 31, 2025 · 2 comments

Comments

@Mgrmjp
Copy link

Mgrmjp commented May 31, 2025

Intelephense currently does not recognize functions from WordPress plugins like WooCommerce unless the plugin source code is explicitly added to intelephense.environment.includePaths.

This causes issues in typical WordPress projects where:

  • WooCommerce (or another plugin) is installed in wp-content/plugins/
  • A theme or custom plugin uses common functions like wc_get_order() or wc_price()
  • Intelephense reports "undefined function" errors, despite the plugin being present in the workspace

Problem

  • WordPress plugins define functions in included files, often conditionally, and not via autoloading.
  • Intelephense doesn't follow WordPress’s loading logic, so these functions are skipped during indexing unless their paths are manually added.
  • This leads to missing definitions, broken autocomplete, and false-positive errors.
  • On systems with multiple projects (e.g., WSL on Windows), maintaining separate includePaths for each workspace is not scalable.

Proposal

Improve WordPress compatibility by indexing plugin code from known standard paths when a WordPress install is detected:

  1. Detect WordPress projects by checking for wp-config.php in the workspace.
  2. Automatically index:
    • wp-content/plugins/**
    • wp-content/mu-plugins/**
  3. Allow this behavior to be toggled via a setting, e.g.:
"intelephense.indexWordPressPlugins": true

This would eliminate the need for per-project manual configuration in common environments.

This change would improve support for real-world WordPress development and reduce unnecessary configuration overhead.

@bmewburn
Copy link
Owner

If you have a set of wp plugins that you frequently use for many projects couldn't you use the vscode user settings to avoid per project configuration?

@Mgrmjp
Copy link
Author

Mgrmjp commented Jun 1, 2025

Maybe, but it would be greatly convenient the extension looked at the plugins folder, if only opening a theme or plugin.

That would also properly use the correct version of the plugins to avoid wrong information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants