JQuery UI Autocomplete/Autosuggest WordPress
JQuery UI Autocomplete/Autosuggest WordPress
JQuery UI Autocomplete/Autosuggest WordPress
How to stop a nonce from being cached in an inline script, or alternatives to regenerate it if expired?
To simplify your process and prevent redundant conditional checks just stack the two actions on top of each other. wp_ajax_ runs for authenticated users and thus does the conditional check of is_user_logged_in() anyway. wp_ajax_nopriv_ does the same thing, but looks for unauthenticated users. The actions themselves run the conditions anyway, so you needn’t run it … Read more
WordPress REST API FormData: Form Not Submitted When No Files Attached
Uncaught ReferenceError: custom_ajax is not defined
Assuming your apps/save-books.php file contains the save_book_form() function and the wp_ajax_save_book_form hook, the problem is that you’re only including this file inside the admin_menu hook. The admin-ajax.php file does not run the admin_menu hook, so your apps/save-books.php file won’t be loaded for admin AJAX requests, which means that your action is never hooked. You need … Read more
The problem was that the PHP AJAX function was redirecting to another page, which caused these issues. I decided to just generate a link instead of redirecting.
If the point of the file is to allow the website to asynchronously post data why would it even be allowed to be accessed directly, especially from an ip that is not the ip of the site itself? AJAX requests come from the user’s IP address, not the site’s, because an AJAX request is by … Read more
They’re not triggered in the normal WordPress lifecycle. They’re only triggered when you make a request to admin-ajax.php, and they’re triggered as the last action before shutdown. You can see this in the file itself: https://github.com/WordPress/WordPress/blob/master/wp-admin/admin-ajax.php#L188
That process would normally be placed in a theme, so you would have to create a Child Theme of your current theme, and then modify the Comments template to provide that functionality. You don’t want to make changes to theme files directly, as an update to the theme will overwrite your changes. Many articles on … Read more