Skip to:
Content
Pages
Categories
Search
Top
Bottom

Calling an file in a higher directory from plugin

  • On my site, I have a file of general purpose functions in the site root called “mysite_functions.php.” I have WordPress installed in /wordpress, and bbPress installed in /wordpress/bbpress. I have altered wp_setcookie() and wp_clearcookie() in a WordPress plugin. In those two functions, I use require_once('../mysite_functions.php');, and then the function call. It works fine.

    The problem comes in the bbPress plugins. I have a plugin overriding bb_login() and bb_logout(). In each of those functions I use the exact same code to call mysite_functions.php, but I get “failed to open stream: No such file or directory in [file path] [line number]“

    In either case, the functions are unchanged with the exception of appending:

    require_once("../mysite_functions.php");

    call_my_function();

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.