AJAX – get_posts for a specific post type returns empty
AJAX – get_posts for a specific post type returns empty
AJAX – get_posts for a specific post type returns empty
jQuery.post returns 0
You can and should totally do this in my opinion. Especially if you have a RESTful case. I personally only use admin-ajax for very simple things to almost no more.
Simple AJAX code that refreshes every x seconds?
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
Can I use application/json content type in WordPress
If you want to use the same function you have to detect ajax call (echo) from shortcode (return) like this : function get_attr_href() { ob_start(); var_dump($_POST); include ‘articlesTabs.php’; $html = ob_get_clean(); if(wp_doing_ajax()){ echo $html; wp_die(); } return $html; }
If I leave out the wp_die() in the testiframe function I get the ‘0’ appended to my output. If I put it in, the page w/ iframe linked to it crashes
How to ignore WP_ERROR caused by “get_the_excerpt” method in an AJAX call?
Is there a public ajax endpoint?