Your action should be wp_ajax
and wp_ajax_nopriv
instead of admin_ajax
.
add_action( 'wp_ajax_new_message', array($this, 'process_upload') );
add_action( 'wp_ajax_nopriv_new_message',array($this, 'process_upload') );
Related Posts:
- Do I require the use of nonce?
- simple wordpress ajax plugin not working when not logged in
- Problem with WordPress Ajax form
- How to set a custom path, for ajax image upload folder in admin?
- admin-ajax.php responding with 0
- Page Reloads Before AJAX Request Finishes
- wp_insert_post() is returning the correct post ID, no failure, but the post content does not get updated
- How to test nonce with AJAX – Plugin development
- Create onClick Event to Re-load a Widget
- WordPress ajax doesn’t display object method on jQuery .change() function
- adjust section according to country?
- How to send Ajax request from my plugin in admin dashboard?
- AJAX success response is not working but it’s saving my changes
- how to update and display an option without reloading the page
- Using data sent via AJAX in multiple functions on a WP plugin
- Problem with AJAX in wordpress plugin
- Any ideas why I am getting “I’m getting “wp-admin/admin-ajax.php 401 (Unauthorized)”
- Execute Jquery when a specific page in my plugin is loading
- PHP: How to access db the right way in plugin?
- calling admin-ajax.php from admin-ajax.php
- Submit form to db
- How to use wp_send_json() and output the value with ajax?
- Ajax on the Administration Side of plugin – wp_localize_script – how to pass value from JQuery to PHP function in class?
- Is it possible to access admin-ajax.php using PHP?
- Settings API form – submit with AJAX
- Post form – AJAX won’t upload featured image – Plugin development
- How can I get my WordPress plugin to receive data and relay it in an ajax/php request to a remote server that requires authentication?
- Submit remote form to wordpress REST API and save data to custom post type
- custom mailchimp form using HTTP API
- Input field duplicates on form submit by jQuery
- Ajax in a class instantiated via shortcode
- defined (‘ABSPATH’) false after AJAX post to other PHP-file
- AJAX & PHP | Call a specific PHP function from a PHP file via AJAX?
- Cookie not created in AJAX request
- How to pass and validate nonce in custom REST routes
- getJSON response to PHP
- ajax problems on loading page [closed]
- Real time Duplicate title check
- Load custom field value into div with AJAX
- Ajax form submit within a Post Metabox
- Stumped – Ajax Response Returns 0
- Trying to implement Ajax comments in WordPress, getting WP error
- Can’t search posts using WP_QUERY inside AJAX Function
- Woocommerce add to cart quantity buttons with AJAX
- WP add_action factory
- Swapping wp_dropdown_categories function with wp_category_checklist
- How to show phpinfo() only in a new tab?
- How can I remove a function that has been added to wordpress with add_filter?
- Ajax load more posts with multiple tax query
- Ajax call not working
- WordPress Sending data to Ajax with select option
- populate form fields in a loop with ajax
- Plugins not working on AJAX requests
- How can I hide that I Use WordPress (with W3 Total Cache)
- Saving plugin settings – ERROR: options page not found
- Custom array from a query only write the last row of the query
- AJAX button action in foreach
- Is it possible to define variables in a wordpress shortcode, and then call the shortcode using a specific variable?
- load ajax using admin-ajax.php
- Ajax button not working
- Custom meta box values are not getting saved for my custom post type
- Simple AJAX notification when the new post is added to the database
- Is it possible to create new user from external form using REST API?
- When echo follow Ajax button inside Ajax pagination template not working?
- jQuery Ajax PHP function call returning [object Object]
- Can’t upload CSV file to plugin directory using custom upload form in admin panel
- Validate and Sanitize WP REST API Request using WP JSON Schema?
- Retrieve Json data and create multiple pages with it
- Can I remove or edit an include() from a function with a filter?
- Call to undefined function error in plugin
- How do I make this Metabox show current DB value?
- PHP Warning: Missing argument 2
- Get category id when SEO URL is turned on
- Disclaimer that will show every refresh of the page
- Failed to load resource: the server responded with a status of 500 (Internal Server Error) through wp_admin_ajax.php
- How to extend SelectControl with data from my theme
- Ajax filter with loadmore button
- How can i avoid duplicate same post in wp?
- How do I disable cache for a certain page?
- AJAX and custom pages
- using filter and hook inside class
- $.ajax results in 403 forbidden
- How does one make a URL return dynamic JSON with custom Content Type?
- wp_set_object_terms returns 500 error when called through AJAX function
- How can i send id of the currently posted form data through json response in custom wordpress plugin?
- How to give custom roles the capability to edit one Menu instead of every Menu
- Cannot successfully execute AJAX script to call function.php specific function. Using XAMPP localhost to test
- How to load WP_Editor JS files manually (with AJAX)?
- Private messaging – Getting and displaying the avatar/url of a message recipient
- widget: input the px value from user and use it as inline style in widget function
- 403 (Forbidden) delete file image in themer folder
- Problems with plugin that fetches data from database with ajax
- How to get site homepage from plugin?
- Dynamic Gallery
- SHARING TO FACEBOOK – FROM DYNAMICALLY GENERATED PAGE
- Jquery autosave text area after typing
- Pass a PHP variable (loop-audio.php) to jQuery function (js/script.js)
- Correct way to perform a GET to another PHP file hosted on wordpress
- Woocommerce Convert existing order to the cart
- Redirect posts to post editor page based on query string