WordPress POST AJAX call, var_dump($_POST) NULL and AJAX response empty when inside ob_start
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; }