if my main.php file is located inside /wp-content/plugins/myplugin/folder/folder/folder/ why including urls.php , located inside /wp-content/uploads/folder/ doesn't work with this path:

include_once("../../../../../uploads/folder/urls.php"); 

it works only if placed inside same folder as main.php with path ('urls.php');

2 Answers

you can use content_url() it's located with wp-content folder.

Or for path

you can use WP_CONTENT_DIR it'll located to wp-content folder.

require_once(WP_CONTENT_DIR. 'uploads/folder/urls.php'); 

Check more info Documentation

4

It seems strange. Do you have any error message when you run your main.php? Try to check again, maybe a typo somewhere. Do you take help of Text editor auto-completion when calling urls.php?

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy