Support » Plugins » Ajax in Plugins with OOP

  • 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.

  • The topic ‘Ajax in Plugins with OOP’ is closed to new replies.