WordPress environment not loading properly

please help me with this i’ve been working on it for 2. I am sorry if the title isn’t the exact explanation of the problem but i just can’t figure out how to handle this problem.
I created a php plugin but the php file isn’t able to call any type of wordpress function example – (add_action).
at first it was giving me an error saying function undefined.
After giving giving it the location of the wp-load.php file it stoped giving me the error but it still isn’t loading anything called with add_action.
What do you think is causing this problem.

   $parse_uri = explode( 'wp-content', $_SERVER['SCRIPT_FILENAME'] );
   require_once( $parse_uri[0] . 'wp-load.php' );
   function addText(){
     echo "hello world";

Also i am loading this from the tinymce editor.
This is the tinymce button code it’s only job is to load the php file.
I know that i am not calling ajax in the correct way but this is the only way i can call it because it is directly loaded from my javascript file.

(function() {
    tinymce.PluginManager.add('ImageSlider', function( editor, url ) {
function customfunction() {
    jQuery(document).ready( function($) {
        var dir1 = "../wp-content/plugins/Midnight Image-Slider/MDslider.php";
            url: dir1,
            success: function(data) {
editor.addButton( 'ImageSlider', {
    title: 'My test button',
    image: url + '/lion.jpg',
    onclick: function(){
            title: 'Image slider',
            onSubmit: function(e) {



Source : Link , Question Author : iani garthalski , Answer Author : Community

Leave a Comment