• Hello,

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

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

    and I’m sorry if I’ve posted in wrong section

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • maribge

    (@maribge)

    I guess the second argument for activate_plugin should be something like: ‘plugins.php?error=true&plugin=’ . $pluginName.

    So the function most likely will look like this:

    activate_plugin(‘hello.php’, ‘plugins.php?error=true&plugin=hello.php’);

    ajithperuva

    (@ajithperuva)

    replace your
    require_once(‘path…\wordpress\wp-includes\plugin.php’);

    with

    require_once(‘path…/wordpress/wp-load.php’);
    activate_plugin(‘hello.php’);

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to activate plugins internally ?’ is closed to new replies.