Using the following code in Wordpress returns the error 500 Internal Server Error. What could be the reason?

add_action('wp_ajax_hello', 'say_hello'); function say_hello() { echo 'Привет пользователь!' } 
  • one
    No semicolon after echo. And no die (). This is what is on the surface. - KAGG Design
  • Put a semicolon after echo and the function wp_die () ;. Now another problem. The function returns zero. In the console: 400 Bad Request - Alexander Kovalenko
  • We can do it endlessly debugging. Create a new question, lay out there the whole code, js and php. And before that read kama about ajax in wp - KAGG Design
  • All problem solved. Thank. - Alexander Kovalenko
  • If the answer is useful, it is worth noting as accepted by a check mark below. This will help navigate users who are looking for the answer to a similar question. - KAGG Design

0