I managed to do it by myself thanks to this tutorial.
Moved content of do.php
file to a function named cmr_upload
inside a class.
Then changed the plupload options from:
url : plugin_dir + 'do.php',
...
multipart_params : {
"chapter_id": i,
"path": path
to
url : '<?php echo admin_url('admin-ajax.php') ?>',
...
multipart_params : {
"chapter_id": i,
"path": path,
"action": "cmr_upload"
Then added the function to an ajax action:
$this->loader->add_action('wp_ajax_cmr_upload', $plugin_admin, "cmr_upload");
Related Posts:
- dbDelta not creating tables
- How to fork a plugin?
- Default table collation on plugin activation?
- How to implement color picker from wordpress in my plugin?
- Nonces can be reused multiple times? Bug / Security issue?
- Single Responsibility Principle and WP Classes
- How to auto-upgrade my plugin?
- Category listing with thumbnail and description on home page
- How to Add a .js file Only in one specific Page Dynamically to Head
- Displaying search results in the widget itself?
- Missing “category_children” option when dynamically creating categories via a plugin
- Developing a plug-in to charge for
- How to exclude content (and other returned values) from WP_query()?
- Looking for callback function after Gutenberg is rendered?
- WordPress select dropdown list in widget
- How to duplicate a curl XML request using HTTP API?
- 404 errors after plugin options update and category base change
- How to determine, from plugin script, if active theme has The Post Title
- Widget Admin – Form Submit Event?
- How to add pages to custom menus on the fly [duplicate]
- How can I add a CSS rule to edit.php?
- How do you render_callback for register_block_type to a method in another class?
- add_filter : Passing an array instead of the callback function?
- WordPress security issue to output data from user input from theme option form
- How to add settings subpage from a plugin to a settings page created in theme?
- Using wp_parse_args to set up Plugin Default Settings
- how to add Jquery script to one page?
- how do you prevent showing a particular category on the admin dashboard for specific user roles?
- how query string in wordpress receive the value other than post and page [duplicate]
- get_posts() not working when accessing with a custom user role
- Is there no admin ui guide for 4.x?
- Is there an event or an other method that tells me the preview is loaded?
- Admin Plugin POST to another file within the plugin
- Do I have to worry about useState causing a re-render?
- Plugin sub-menu pages recommended structure and links
- Widget Dropdown doesn’t working
- mysql_real_escape_string() vs. esc_sql() in WordPress
- Display list of uploaded images, filtered by user under a specific user group
- pagination in a custom list created with get_pages function
- Bug: Post needs to be updated twice when adding action for save_post hook
- my own SVN for a plugin/theme
- How to enqueue scripts in right way in a plugin?
- Plugin AJAX Save to Custom Table
- How can I add function calls to my plugin’s options.php default submit routine?
- How To Update WordPress Custom Plugin For Customer? [closed]
- Secruity Questions on a timer
- modify show UI of a registered taxonomy
- Open tab on current day problem jQuery and WordPress
- get_shipping_methods() return empty rate
- Plugin working on my local installation but Cannot be activated online
- How to insert HTML/CSS/JS into my iframe plugin?
- Is there a WordPress plugin to design WebGL? [closed]
- WordPress Page Reload Takes forever during theme development
- How to close tinymce inline popup
- Why doesn’t update_post_meta work for certain strings?
- How to add some basic inline CSS using existing plugin or theme?
- Font size of HTML content
- How to write a shopping queue line plugin with a queue button?
- New jquery and bootstrap breaks plugin
- WooCommerce maintaince mode by using php
- Rerender core Templates with with ToggleControl but it doesnt recognize block type
- How do I add filter with woocommerce categories?
- Where do I hook to have the server do something in PHP on block attribute change?
- Some difficulties in implementing markdown editor
- WordPress shortcode with a switch
- How to get access the ID of all posts of custom post type in Gutenberg editor
- Share functions between admin and frontend
- Editor Plugin – Breaks when toggling between Visual to Text
- Woocommerce Single Product Tabs Got Duplicate
- Inserted data from database does not showing on front-page without referesh page?
- wp_editor embed shortcode not working within my plugin
- Can i prevent the effect of the_title filter on the dashboard’s posts/pages titles?
- How to embed or integrated a custom WordPress Widget into the theme?
- Making adding info to an overlay bio easy for average user?
- Moving the “share” button
- Confusing $tag specification for apply_filters call, in core options.php code
- Delete Query executing regardless of WHERE Clause condition
- How to change the wording of front-end `next article` for custom type registered in a plug-in?
- Get (eventual) permalink from post within Edit Post in Admin panel
- Ajax not working to insert, query and result data
- wordpress plugin require_once file – can’t user wordpress functions
- Is there a way to tell if a shorcode’s handler is being run before or after the content formatting filter?
- Plugin files not updated (cache cleared)
- How to limit the number of posts a user can view based on status
- WordPress permalink setting
- How to create an embedded code for wordpress shortcode?
- Error when trying to save custom post type settings (ERROR: options page not found)
- Developing a plugin, ran it through P3 Profiler, shows up slow, but I don’t know why
- Dynamic banner for use on external sites
- How to add additional field in a table row after creating a table?
- WordPress plugin tables become corrupt
- How to call a new php page inside a plugin page?
- How can i call from custom fields to the category editor?
- Practical Solutions to HTML5 Video on WordPress
- Is it possible to convert various image types from remote URLs to WebP and then serve them immediately?
- If I want to create new taxonomies (e.g. Project / Documents / Etc…) is it better to create them in the theme’s functions.php or within a plugin? [duplicate]
- Is the only way to add taxonomy terms via an admin panel?
- Is using upgrader_process_complete the correct way to perform plugin updates?
- Load images from CDN and custom features to “Add Media” dialogue
- Saving metabox updates causing fatal error