I need to call ajax request function from WP-CLI with POST parameters so my question is how can I set post params in do_action mention that I am calling from WP-CLI.
Example:
add_action( 'wp_ajax_publish_submit', 'publish_submit' );
add_action( 'wp_ajax_nopriv_publish_submit', 'publish_submit' );
function publish_submit() {
$platform = $_POST['platform'];
$env = $_POST['env'];
...
}
// calling this ajax request from WP-CLI as below
wp eval "do_action('wp_ajax_publish_submit');"
I have tried with --args but did not worked. Also tried to set $_POST['platform'] but that also did not worked.
But not able to set platform
and env
post request params for do_action function that call ajax request function.