Support

Account

Home Forums Add-ons Gallery Field Include once error

Solving

Include once error

  • Hello!

    I am using the Gallery add-on plugin. In my functions file I have:

    include_once(‘acf-gallery/acf-gallery.php’);

    as per instructions.

    This works fine on my local machine but when I upload this onto a web server I get an error message. The error I am getting is:

    include_once(acf-gallery/acf-gallery.php) [function.include-once]: failed to open stream: No such file or directory

    I believe this is due to the path being incomplete or incorrect.

    Is there another way of including this in PHP that will find path regardless of the server?

    Many thanks!

  • I also tried:

    include_once( get_stylesheet_directory() . ‘/acf-gallery/acf-gallery.php’ );

    But this does not work either.

  • Did you try get_template_directory() https://codex.wordpress.org/Function_Reference/get_template_directory

    When you get the error there should also be a report of exactly what the path to the file is that it’s looking for. Make sure that this matches up with what you expect it do be.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Include once error’ is closed to new replies.