wordpress fails to load my hooks

hello i’ve been dealing with this all day and i just can’t figure out what is causing this problem please help me.
I have called a php file using ajax through the wordpress editor with a button.
This code is in my tinymce button file calling the php function

jQuery(document).ready( function($) {   
    var dir1 = "../wp-content/plugins/Midnight Image-Slider/MDslider.php";
        url: dir1,
        success: function(data) {

And when it calls the php file it gives me this error
wordpress Uncaught Error: Call to undefined function
unless i write the require wp-config.php part at the top of the php file then the error goes away but it is still not loading any wordpress hook.

function loadFile(){
echo 'hello world';

hello world is being displayed only when it is not in a function but i need to be able to use the wp hooks i think that some files are not being loaded.

Read more here: wordpress fails to load my hooks

Leave a Reply

Your email address will not be published. Required fields are marked *