file : url + '/shortcode_generator_popup.php', 

I would like to move this file one folder above the current one that it's in. I'm wondering how I can rewrite this so that is points to the folder above. I've tried: file : url + '../shortcode_generator_popup.php' but of course it only turns into: /includes/js../shortcode_generator_popup.php

Thanks for any help!

1 Answer 1


I think the best way is to use the before_wp_tiny_mce() hook. Then, you can define the url in PHP; and pass it to the page so it is available to TinyMCE.

function sgp_before_wp_tiny_mce() {

    <script type="text/javscript">
        var sgp_plugin_url = "<?php echo plugins_url('shortcode_generator_popup.php', __FILE__); ?>";
add_action('before_wp_tiny_mce', 'sgp_before_wp_tiny_mce');

You may need to change the plugins_url() to match the appropriate location of your php file.

Then, you can use the variable in your plugin tinymce script to get the location.

    file : sgp_plugin_url,

I haven't tested this... it's from memory. Let me know if you encounter any issues and I'll adjust accordingly.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.