WordPress.org

Forums

Proper use of activate_ hook? (2 posts)

  1. Jeriko
    Member
    Posted 8 years ago #

    I'm writing a plugin which will put some default values into the options table through a function called by the activate_ hook. However, this needs a somewhat hardcoded URL, meaning that the user needs to save the plugin file at a predefined location.

    So I was wondering, if the current location of the plugin file can be determined and passed to the hook? This way, the user could put the plugin in a subdirectory or where he wants it.

    Cheers, Jeriko

  2. Try using register_activation_hook (in wp-includes/plugin.php) to register the hook using the filename of the plugin from __FILE__

Topic Closed

This topic has been closed to new replies.

About this Topic