Title: Wrong path require_once for admin.php
Last modified: August 30, 2016

---

# Wrong path require_once for admin.php

 *  Resolved [3pepe3](https://wordpress.org/support/users/3pepe3/)
 * (@3pepe3)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/wrong-path-require_once-for-adminphp/)
 * Hello,
 * On line 9 of network-shared-media/medias-upload.php require_once will fail if
   we have we have changed WP_PLUGIN_DIR on wp-config.php
    Exemple:
 * wp-config.php
 *     ```
       define( 'WP_PLUGIN_DIR', $_SERVER['DOCUMENT_ROOT'] . '/p' );
       define( 'WP_PLUGIN_URL', $protocol.$_SERVER['SERVER_NAME'].'/p');
       ```
   
 * on line 9, medias-upload.php this will fail :
    `require_once( dirname( dirname(
   dirname( dirname( __FILE__ ) ) ) ) . '/wp-admin/admin.php' );`
 * To fix this you can can replace line 9 by:
    `require_once( $_SERVER['DOCUMENT_ROOT'].'/
   wp-admin/admin.php' );`
 * [https://wordpress.org/plugins/network-shared-media/](https://wordpress.org/plugins/network-shared-media/)

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

 *  Plugin Author [joost de keijzer](https://wordpress.org/support/users/joostdekeijzer/)
 * (@joostdekeijzer)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/wrong-path-require_once-for-adminphp/#post-6283148)
 * Thanks for the report! Will try and fix this soon.
 *  Thread Starter [3pepe3](https://wordpress.org/support/users/3pepe3/)
 * (@3pepe3)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/wrong-path-require_once-for-adminphp/#post-6283151)
 * Thanks… and nice work
 *  Plugin Author [joost de keijzer](https://wordpress.org/support/users/joostdekeijzer/)
 * (@joostdekeijzer)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/wrong-path-require_once-for-adminphp/#post-6283379)
 * Hi 3pepe3,
 * Best solution seems to be to deprecate the media-upload.php file and use an ajax
   call. Than, any “custom configurations” should work out-of-the-box.
 * I’ve done a beta here: [https://github.com/joostdekeijzer/wp_network_shared_media/tree/admin-ajax_ipo_media-upload](https://github.com/joostdekeijzer/wp_network_shared_media/tree/admin-ajax_ipo_media-upload)
 * Could you possibly test it? For me, it seems to work fine.
 *  Thread Starter [3pepe3](https://wordpress.org/support/users/3pepe3/)
 * (@3pepe3)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/wrong-path-require_once-for-adminphp/#post-6283382)
 * It works 🙂
 * I’m not getting any notice, warning or anything else…
    Maybe the next big step
   on the plugin would be to use the new media upload introduced on WP +3.5 With
   the new media upload (wp.media()) then it would be possible to add a the new 
   tab on the media upload window where the left sidebar is not displayed (like 
   in the “featured image” or “Customizer options”)… this means showing a top tab
   where the filter media_upload_tabs is not triggered.
 * Here is a nice video talking about this:
 *  Plugin Author [joost de keijzer](https://wordpress.org/support/users/joostdekeijzer/)
 * (@joostdekeijzer)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/wrong-path-require_once-for-adminphp/#post-6283383)
 * Hi 3pepe3,
 * Great the fix works. I’ll release it properly soon.
 * About the WP+3.5 media screens: I know and I’ve spent _days_ trying to figure
   out how they work and how to modify my plugin to work with it.
    But currently
   it doesn’t really seem possible without really hacking the code. I haven’t seen
   any other plugin do this either.
 * I’ll look at the video though, did not know it existed. Thanks!
 *  Thread Starter [3pepe3](https://wordpress.org/support/users/3pepe3/)
 * (@3pepe3)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/wrong-path-require_once-for-adminphp/#post-6283384)
 * You welcome, I also spent some days trying to understand the new media screen
   and in lack of documentation the task is very hard.
 * The 2 best resources that I found where :
    [http://shibashake.com/wordpress-theme/category/wordpress-tutorials](http://shibashake.com/wordpress-theme/category/wordpress-tutorials)
   [https://github.com/ericandrewlewis/wp-media-javascript-guide](https://github.com/ericandrewlewis/wp-media-javascript-guide)
 * Have a nice day
 *  Plugin Author [joost de keijzer](https://wordpress.org/support/users/joostdekeijzer/)
 * (@joostdekeijzer)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/wrong-path-require_once-for-adminphp/#post-6283429)
 * v0.11 resolves the issue

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

The topic ‘Wrong path require_once for admin.php’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/network-shared-media.svg)
 * [Network Shared Media (deprecated/unsupported)](https://wordpress.org/plugins/network-shared-media/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/network-shared-media/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/network-shared-media/)
 * [Active Topics](https://wordpress.org/support/plugin/network-shared-media/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/network-shared-media/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/network-shared-media/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [joost de keijzer](https://wordpress.org/support/users/joostdekeijzer/)
 * Last activity: [10 years, 9 months ago](https://wordpress.org/support/topic/wrong-path-require_once-for-adminphp/#post-6283429)
 * Status: resolved