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__); ?>";
</script>
<?php
}
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.
ed.windowManager.open({
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.
Related Posts:
- Reset Undo on the tinymce editor
- Instantiate TinyMCE via JS ( rather than PHP/wp_editor )
- How to append a URL parameter to all outbound URLs
- TinyMCE Button to Insert Multiple Lines of Text?
- TinyMCE in a div / textarea on frontend?
- How to wrap the content of the main tinyMCE editor with extra tags
- preserve url parameters from affliliate sites
- Instantiate TinyMCE via JS ( rather than PHP/wp_editor )
- Add Item to Custom TinyMCE Menu
- Insert shortcode in post editor from javascript (Visual / HTML)
- Add tinymce dynamically via Javascript
- Listbox return wrong value in WordPress 3.9
- Using wp_editor in TinyMCE WindowManager dialog
- Close TinyMCE plugin window on click away
- Make TinyMCE checkbox that returns a value instead of true/false
- TypeError: window.tinyMCE.execInstanceCommand is not a function
- Where is the WP auto-save draft JavaScript?
- How to use div -ids in url to jump to specific post…Is trailing slash the culprit?
- Insert “javascript:void(0);” into URL
- How to set callback to execute after all the tinyMCE editors have been initialized?
- Popup box when Clicking on Insert into post button in wordpress
- Adding and removing hidden buttons from WordPress Customizer Tinymce widget editor using javascript API
- WP TinyMCE (Full + media ) – 4.8 JS Init Dynamicly
- Tinymce.js editor in Chrome?
- wordpress 4.4 upgrade visual editor bullets select for not selected elements
- How to reference TinyMCE body in my script
- How to use WP switchEditors.switchto(this) JS function in your own script?
- How to use value from modal tinymce windowManager?
- WordPress 4.2 mce-views migration guide?
- How to integrate a different (JavaScript) editor in WordPress?
- custom page url slug needs illegal ?id=1 for javascript
- Can I use complex HTML with Twitter Bootstrap’s Tooltip?
- How do I redirect to another webpage?
- Invariant Violation: Objects are not valid as a React child
- How to get all place details from a Place Details Request using Google Places API Web Service?
- How do I loop through or enumerate a JavaScript object?
- Getting Unexpected Token Export
- What’s the difference between “Array()” and “[]” while declaring a JavaScript array?
- Mouseover & Mouseout w/ Javascript
- Format JavaScript date as yyyy-mm-dd
- Programmatically change the src of an img tag
- Unable to preventDefault inside passive event listener
- Scroll Automatically to the Bottom of the Page
- npm WARN … requires a peer of … but none is installed. You must install peer dependencies yourself
- How do I check if string contains substring?
- What does “export default” do in JSX?
- Cannot find module ‘internal/fs’ after upgrading to node 7
- How can I select an element by name with jQuery?
- blocked a frame of origin “null” from accessing a cross-origin frame – chrome
- How can I resolve the error “URL scheme must be “http” or “https” for CORS request.” for this code [duplicate]
- Initializing an Array with a Single Value
- Is it possible to stop JavaScript execution?
- Remove commas from the string using JavaScript
- How can you remove all documents from a collection with Mongoose?
- TypeError: ‘undefined’ is not an object
- Uncaught TypeError: Cannot read property ‘appendChild’ of null
- javascript setTimeout() not working
- Retrieve the position (X,Y) of an HTML element
- command not found: jest
- Angular 2 Hover event
- getElementsByClassName not working [duplicate]
- Javascript: Unicode string to hex
- Preloading images with jQuery
- socket.io – ReferenceError: io is not defined
- What is the difference D3 datum vs. data?
- Must use destructuring props assignment
- Line continuation characters in JavaScript
- Simulate a click on ‘a’ element using javascript/jquery
- How can I remove a style added with .css() function?
- Error: Couldn’t find preset “es2015” relative to directory “/Users/username”
- Using Angular 2 without TypeScript Transpiler
- Trigger Javascript on Gutenberg (Block Editor) Save
- How to intercept already localized scripts
- Show control conditionally in Gutenberg
- Want image captions to be from img ALT tags not title tags
- wp_customize_support_script – do I need it?
- How to add a “data-” attribute to the image tag of native gallery output
- Post to WordPress using REST API from external site
- Set current tab on a Gutenberg TabPanel component from outside that component
- Gutenberg block “This block appears to have been modified externally” on save
- 404 Error Contact Form 7 on WordPress
- Gutenberg get core data – search
- How to edit content before post update
- Add custom classes for blocks in editor based on custom attributes
- Trying to turn the Edit function into a class to be able to use React lifecycle methods
- Return ‘X-WP-Total’ from headers in response
- Javascript asset not enqueuing with the rest
- jQuery UI Tools: Scrollable: More than 1 instance possible?
- imporing HTML+javascript from REST API
- how to add a custom javascript file to our theme
- WordPress Guternberg Content For React Native
- Custom block update rendering when reused
- How do I add my own scripts to the add_action(‘wp_enqueue_scripts’) function?
- Post title and url not showing on google map marker [closed]
- Including js script at end of header
- contact form 7 javascript and wpcf7_before_send_mail action
- Embed Kajabi into WP
- Google AdSense Ad not showing up in WordPress Blog [closed]
- WP REST API – “rest_user_cannot_view” ONLY on specific users
- How to add a new attribute to core wp block editor without npm?