How to call my PHP function with AJAX ? wp_query
How to call my PHP function with AJAX ? wp_query
How to call my PHP function with AJAX ? wp_query
Is it okay to call global $post; inside the loop in ajax or is there a better way to access the current post object? I’d do it outside the loop but in the same scope to avoid duplication, but otherwise the answer is: If it works, then it works, don’t stress about it, there is … Read more
Facing Problem with admin-ajax.php URL – Getting 404 with AJAX call
Change ajax live search results
Simple AJAX code that refreshes every x seconds?
The use of $_POST[‘action’] in the WP_Query and as a dynamic action name is dangerous, and in the code triggers the handler on all AJAX requests even those you don’t want. This is unavoidable and a dead end that cannot be fixed. Alternatives are mandatory. Instead, use a static non-dynamic action name, E.g. mathieu_loadmode_post_archive or … Read more
The send_headers hook is not fired during an (admin) AJAX request (because there is no “main WordPress query”, so the wp() function doesn’t run and therefore that hook doesn’t get fired either), hence if you want to send the CORS header (and any other headers), then just call header() from within your AJAX callback, like … Read more
Load more posts using AJAX based on posts inside WP_Query
sorry. I’m very sorry, I could already solve. I have my local wordpress installation in a site.test/wordpress/ subfolder and in the ajax I make the request without the subfolder. I still have the doubt about the numbers that are added at the end of the url. :/
Can I use application/json content type in WordPress