views:

270

answers:

2

Hello,

I am creating a small utility which will help to rebuild install.php of wordpress.

What I want to achieve is, when user will install wordpress with this customized install.php, he'll get some plugins already activated.

I tried to put these lines at the end of install.php file

require_once('path...\wordpress\wp-includes\plugin.php');
activate_plugin('hello.php');

that activates Hello Dolly plugin but shows error 'invalid datatype for second argument on line 310' for plugin.php

Also, if I try plugins which are inside a folder, for example

require_once('path...\wordpress\wp-includes\plugin.php');
activate_plugin('plugin-folder\file.php');

its not getting activated. [i've tried different combinations for sending arguments, echoing arguments in plugin.php etc. but activate_plugin() does receive correct argument. ]

Consider that plugins are already copied in wp-content/plugins directory.

Whats wrong? Is there any different way to achieve this ?

Thanks

A: 

Instead of including plugin.php file, include the wp-load.php file

require_once('path...\wordpress\wpload.php');

wpload.php will automatically include all the file in the correct order, which should solve your issue.

Sudar
A: 

Atlast I came up with a new activate_plugin function that I added to that file. Problem in old function is the check for active plugins. At first since there is no active plugin, it was returning null value, showing the error. I removed that for my use.

why we dont see errors when using from wordpress dashboard ? wordpress hides them.

Thanks anyway..

Omie