I would simply like to do some WordPress theme development using statements like
require get_template_directory() . '/functions/base.php';
in my functions.php file. It seems IDEs do not know what to make of this function result and therefore do not map out [theme root]/functions/base.php as expected.
I would simply like to do some WordPress theme development using statements like
require get_template_directory() . '/functions/base.php';
in my functions.php file. It seems IDEs do not know what to make of this function result and therefore do not map out [theme root]/functions/base.php as expected.
Share Improve this question asked May 5, 2020 at 22:56 HongPongHongPong 1315 bronze badges1 Answer
Reset to default 0In the process of looking this up I determined the correct answer is to use the full local path in my dev environment, and add a comment in the code like
/** @define "get_template_directory()" "/home/myuser/mywpproject/wp-content/themes/mytheme" */
And this works for the subsequent references in that file in JetBrains IDE / PHPStorm immediately. Thanks to here by Jeff Behnke. I have not checked this on other IDEs. As this is a comment I believe it should not affect server side execution.