WordPress.org

Ready to get started?Download WordPress

Forums

Ajax in Plugins with OOP (1 post)

  1. ckruse
    Member
    Posted 4 years ago #

    Wondering if it is possible to use ajax in a WP plugin with a class? I have the following

    class myClass() {
    
      add_action('wp_ajax_my_spec', array($this, 'admin_ajax'));
    
      function admin_ajax() {
      }
    
    }

    It does not work. Wondering why? Anyone else have this issue. Note that WP doesn't return any errors nor does JS when testing this.

Topic Closed

This topic has been closed to new replies.

About this Topic