phpStorm Doesn't Recognize WordPress if I set Content Root to the Theme Rather Than WordPress Root

I have a copy of WordPress on my local system. If I make my content root the base of the wordpress install (e.g. /wordpress/) it recognizes WordPress functions, etc.

But I want to work on a single theme and I don't need the entire WordPress install to work on that. When I change the content root from /wordpress/ to /wordpress/wp-content/themes/name-of-theme/ it stops recognizing WordPress functions, etc.

I have gone into Preferences-->Languages & Frameworks --> PHP --> WordPress and set the WordPress installation path to the base of the WordPress install (/wordpress/). I have also added as the WordPress base as an include path in Preferences-->Languages & Frameworks --> PHP, yet it still doesn't recognize the WordPress function calls.

What am I missing?


Comment actions Permalink
Official comment


Does the behavior changes if you create Wordpress project from the scratch (like File > New Project > Wordpress Plugin and following the wizard further)? Would be great if you could try that out and let me know the results.

Comment actions Permalink

I have exactly this problem and working as Wordpress plugin makes no difference.


To reiterate; if the Theme or Plugin directory is within the Wordpress path there seems to be no way to get the Wordpress library to load.


Please sign in to leave a comment.