Support » Plugin: Notification - Custom Notifications and Alerts for WordPress » Ajax does not trigger the action

  • Resolved simongcc

    (@simongcc)


    Hello!

    I have followed your tutorial on making an ajax “report a bug” and then I modify it to test by trigger the action.
    If I use the static form in the example, the action did trigger with the action “admin_post_report_a_bug” and “admin_post_nopriv_report_a_bug”.

    But the action seems not being triggered when calling by action “wp_ajax_nopriv_report_a_bug” and “wp_ajax_report_a_bug”.

    I have confirmed the function is being called successfully in both static form or ajax form. Only that
    do_action( 'report_a_bug', $_POST['post_id'], $_POST['message'] );
    does not seems to trigger in ajax situation. Is there any ordering related consideration?

    https://www.smashingmagazine.com/2018/07/wordpress-notifications-made-easy/

    Many thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi, Author,

    I have resolved it.
    I found that the variable name need to be updated.
    The 2 examples used a different name that I haven’t paid enough attention to.
    Thanks a lot.

    Plugin Author Kuba Mikita

    (@kubitomakita)

    Perfect, thanks for letting me know!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.