Trick: require wp-load in a custom folder + plugins, which use relative path = error 500. What to do?

The question is not only for WP, but PHP in General.

I have a file .php in a certain folder (let's call it P), regardless vordpressovskih structure with pages, posts, etc., However in this file I need a wordpress function, namely wpdb.
So I write this:

And everything seems fine.

However, one of the plugins has a file index.php which is done like so:

Well, this init.php when you download the plugin on this page, starts first searched in the folder P, and then in the plugin folder.
And if he can find - will not find it... will conflict, and most likely the 500 error - page cease to work.

The question of what to do?

There are some clever options to load wp-load disabled plugins etc.
But, you know, and then you have to disable the theme, etc. Then the whole function should write. And copy-paste it in each page. Ready but there is no such function. And reluctance to write.
June 10th 19 at 14:45
1 answer
June 10th 19 at 14:47
Read the question carefully. - allen_Davis49 commented on June 10th 19 at 14:50
Well, you at least throw an error - albertha.Medhur commented on June 10th 19 at 14:53
, Take off.
Your mistake is carelessness. - allen_Davis49 commented on June 10th 19 at 14:56
I blind or slices of logs here? - albertha.Medhur commented on June 10th 19 at 14:59

Find more questions by tags WordPress