• What am I doing wrong? I am writing a plugin that will save text files to a directory inside the plugin folder. When the plugin activates, I want it to check if the folder exists and, if not, create it and set permissions to 777.

    I am doing a global define of the folder to use throughout the plugin.

    The plugin activates, but no folder is created…

    Thanks!

    define('TXTFOLDER', get_bloginfo('wpurl')."/wp-content/plugins/fooplugin/txtfiles");
    
    function foobar_install () {
    	if (!file_exists(TXTFOLDER)) {
    		mkdir(TXTFOLDER, 0777);
    	}
    }
    
    register_activation_hook(__FILE__, 'foobar_install');
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Make directory with plugin activation’ is closed to new replies.