You’ve got a typo in the hook that runs for logged in users:
add_action('wp_ajax_search_notify_emaill', 'search_notify_email');
There’s an extra l
in the hook name. The hook names need to be the same, apart from nopriv_
, so you should have:
add_action('wp_ajax_nopriv_search_notify_email', 'search_notify_email');
add_action('wp_ajax_search_notify_email', 'search_notify_email');
When you send an AJAX request with an action
WordPress runs the hook wp_ajax_{$action}
(where $action
is the parameter passed with the request) if you’re logged in, or wp_ajax_nopriv_{$action}
if the user is not logged in. Since you’d used an incorrect hook name for the logged-in version (due to the typo) your search_notify_email()
function wasn’t hooked to run when the user was logged in.
Related Posts:
- Drag and drop multiple file upload using Ajax WordPress
- Turn jQuery.ajax() request into XMLHttpRequest (vanilla JavaScript)
- admin-ajax.php HTTP400: BAD REQUEST – The request could not be processed by the server due to invalid syntax
- WordPress AJAX Call Not Return Result
- Ajax Modal Flickers When Opened Multiple Times
- splitting the URL using jQuery
- Refresh Markercluster after ajax call
- How to display contact form 7 form in vanilla js without jquery in frontend
- Uncaught TypeError: Cannot read properties of undefined (reading ‘message’) [closed]
- javascript onClick update user_meta from jquery.ajax
- Ajax sometimes work and sometimes just don’t work
- React to AJAX adding to the page
- Download doccument on server rather than clients browser
- Javascript output now showing in custom widget
- WordPress Ajax send response on every iteration of a loop
- AJAX call not initializing for non-admins in WordPress
- Cross-Origin Read Blocking (CORB)
- jQuery get textarea text
- How to generate a simple popup using jQuery
- What does on() in JavaScript do?
- AJAX response error: net::ERR_EMPTY_RESPONSE
- Access-Control-Allow-Origin error sending a jQuery Post to Google API’s
- jQuery Ajax POST example with PHP
- SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
- Enable Submit Comment Without Page Reload (Using Ajax)?
- Ajax Load More Posts in Category Page
- WordPress Ajax always returns a 404 error
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- AJAX Implementation
- Trying to get single posts to load on the front page via ajax
- Dynamically changing navigation links (next and previous) via AJAX
- Ajax not firing properly using Firefox, but works in Chrome
- Quick Edit: Selected Custom Taxonomy Not Refreshing After Save
- How to create popup same as wordpress popup feature
- Nonces, AJAX, script variables & security in WordPress
- Extending wp JavaScript base class to make a post request to a custom REST endpoint
- How to speed up admin-ajax.php in wordpress
- Admin Ajax and HTML5 Formdata
- Help with AJAX front end comment moderation
- Sending jsPDF documents to the server
- jQuery Ajax passing empty parameters to my function?
- WordPress customizer refresh screen after save
- Woocommerce Ajax Add cart not working
- How to test nonce with AJAX – Plugin development
- Correct way to write jQuery functions in WordPress
- AJAX Load more on CPT returning random posts
- AJAX request randomly stop working and returns error 400
- Making an ajax request from a different domain
- How to Dynamically Load Content Into Body of Bootstrap Modal Window?
- How to add a do_action on refreshing of WP customizer?
- Performance optimization of tree like structure
- How do I query posts by a sub value with the API?
- Trouble with WordPress Ajax Login System – 302
- How to add a Custom Mailchimp AJAX Newsletter Subscribe Form
- Fancybox type popup window that’s not an iframe
- Why is wp_localize_script returning false?
- How to pass parameters from jQuery ajax into PHP function?
- url – ajax loaded but no JS
- merge wp rest api query to get posts per category does not work
- Using admin-ajax prevents regular php form submission
- Properly embed javascript into WP (using function.php) – doesn’t work?
- WP AJAX post filter > do something with empty value
- Load more posts in the same category – Ajax + Timber
- How to jQuery Ajax show new data from successful insert?
- Hide Load more Ajax button if there is no more users to load or less than the number?
- Why i can’t get custom fields value or post ID via Ajax?
- Custom AJAX form not working async
- Contact form – ajax, wp_mail
- Accessing an API with jQuery and AJAX
- Replace link with form to pass variables to javascript / ajax
- Change Query Arguments (filter) with jQuery/Ajax or PHP?
- Get localize of a loaded javascript
- Tracking Visitor LatLng with WordPress using JS, PHP. How to put data which was extract using JS into DB
- Fetch value using AJAX in WordPress
- Query data after an Ajax insert
- AJAX not working when clicking load more button, when two terms are present in tax_query
- Search live Ajax
- Sending email through Ajax without page refresh hangs on admin_ajax.php
- How to pass value from ajax to php in no conflict mode?
- How to pass values from one function to the other using an array variable
- Opening Modal popup on Ajax form submission
- JS working when used normally but not in wordpress
- JS global variable doesn’t update
- AJAX POST Value not being returned – WordPress – AutoTrader API
- How to echo a PHP code into WooCommerce variation product?
- How to call a function from functions.php with ajax?
- Ajax call on class returns old data
- Ajax show custom post data form & script
- Create a post with REST API and adding a category
- Ajax post doesnt call succes after got the response
- Get ajaxForm response value
- How to submit form data in the same page in WordPress without reloading the page?
- Jquery wrap permalink in a data-attribute?
- Colorbox not working on native WordPress gallery when gallery is loaded thru AJAX
- Find the method which AJAX GET calls
- ‘Dehighlighting’ navigation once clicked
- WordPress sound bell when new data will add
- AJAX admin Internal 500 error Failed to Upload
- Custom WP rest api endpoint only working on non https?
- iOS and ajaxComplete