I am developing locally and have a problem with this code:

plugin_dir_path( __FILE__ ) . 'ben/'

If I echo this out it is: C:\xampp\htdocs\plugintest\wp-content\plugins\my-plugin\admin/ben/

If I try to use it in a function:

function my_acf_settings_path( $path ) {
    $path = plugin_dir_path( __FILE__ ) . 'ben/';
    return $path;

The output is: http://localhost/plugintestC:xampphtdocsplugintestwp-contentpluginsmy-pluginadmin/ben/


  • the result is unlikely to be related to the line of code you use, show the full relevant code Jan 11, 2017 at 13:48
  • I am actually attempting to use the code here: advancedcustomfields.com/resources/… but changing the template directory to my plugin directory, the include seems to work but the other 2 functions seems to use the URL menttionned. Jan 11, 2017 at 13:51

1 Answer 1


This was fixed by using plugin_dir_url.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.