Skip to content

feat: Auto-enable WordPress stubs for Intelephense LSP #17235

@superdav42

Description

@superdav42

Problem

When working on WordPress projects with OpenCode, the Intelephense PHP language server does not recognize WordPress global functions like:

  • add_action()
  • add_filter()
  • wp_send_json()
  • do_action()
  • apply_filters()

Users must manually configure intelephense.stubs to include "wordpress" in their OpenCode config file, which is not intuitive and creates friction for WordPress developers.

Context

This affects:

  1. Full WordPress installations (sites with wp-config.php)
  2. WordPress plugins (no core files, but have plugin headers)
  3. WordPress themes (no core files, but have theme headers)

The WordPress stubs are already bundled with Intelephense, they just need to be enabled via configuration.

Reference: bmewburn/vscode-intelephense#1302

Proposed Solution

Automatically detect WordPress projects and enable WordPress stubs for Intelephense. Detection should work for:

  • Core WordPress files (wp-config.php, wp-content/, etc.)
  • Plugin headers (Plugin Name:)
  • Theme headers (Theme Name:)
  • WordPress code patterns (add_action, add_filter function calls)

Verification

To verify the fix works:

  1. Open a WordPress plugin/theme project
  2. Open a PHP file with WordPress functions
  3. Check that add_action() and other WP functions show completions and hover info

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)needs:complianceThis means the issue will auto-close after 2 hours.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions