• I’m writing a shoutbox plugin that uses AJAX to make calls to my shoutbox.php and retrieve content.

    I’m able to use get_userdata() in functions that echo text into the content, but when AJAX calls other functions from the same file that call get_userdata(), I get
    Fatal error: Call to undefined function get_userdata()

    I’ve place the following lines at the top of my plugin

    if (!function_exists('add_action')) {
        require_once(get_option('siteurl')."/wp-load.php");
    }

    but I still can’t seem to make it work. Any ideas or workarounds?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Using get_userdata() in plugin referenced by AJAX.’ is closed to new replies.