Answer the question
In order to leave comments, you need to log in
How to pass a parameter to add_action in a function?
Hello, here is the URL and code:
https://test.ru?idGame=64
$id_game = $_GET['idGame'];
var_dump($id_game); // выводит число 64
function true_load_posts($id_game){
var_dump($id_game); // выводит NULL string(0) "";
}
add_action('wp_ajax_loadmore', 'true_load_posts', 10, 1 );
add_action('wp_ajax_nopriv_loadmore', 'true_load_posts', 10, 1 );
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question