• Resolved janjarfalk

    (@janjarfalk)


    Resolved! – I saw the solution when I was explaining the problem.

    My past problem
    I am writing a plugin that uses thickboxs iframe functionality to load and show edit functionality. When the iframed file is in the wp-admin dir everything works perfectly. But when I move it, and changes the require_once paths it stops working.

    The file I am requiring is admin.php. When the iframed file is located in wp-admin I do like this – require_once(‘admin.php’) – which works perfectly. When I move the file to wp-content/plugins/myplugin and changes the require_once to require_once(‘../../../wp-admin/admin.php’) it get this error:

    [20-Mar-2009 16:36:25] PHP Warning:  require_once(../wp-load.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory in /Users/janjar/Documents/projects/zzz/html/wp-admin/admin.php on line 19
    [20-Mar-2009 16:36:25] PHP Fatal error:  require_once() [<a href='function.require'>function.require</a>]: Failed opening required '../wp-load.php' (include_path='.:/Applications/MAMP/bin/php5/lib/php') in /Users/janjar/Documents/projects/zzz/html/wp-admin/admin.php on line 19

    The solution to my problem
    require_once(‘../../../wp-load.php’);
    require_once(‘../../../wp-admin/admin.php’);

    I just added require_once(‘../../../wp-load.php’) above require_once(‘../../../wp-admin/admin.php’);

    By the way is there a better way of getting to wp-load and admin besides ../../../

    Sometimes it actually helps to read the error messages,
    Jan

  • The topic ‘require_once(‘admin.php’) not working outside wp-admin’ is closed to new replies.