Helping you Build Your Own Social Network!

Faster, better and easier!

How to override this function?

(3 posts) (2 voices)
  • Started 1 year ago by rogeriotoledo
  • Latest reply from rogeriotoledo

  1. Hi Guys,

    I'm looking for some way to hook/override this function:

    function install_blog_defaults($blog_id, $user_id) { ... }

    I want to hook/override this function, because I want to disable the "Hello World!" post and comment that are automatically created as soon as a new blog is created. I know that this function is responsible for:
    - Create the default links;
    - Create the first post (Hello World!);
    - Create the first comment.

    I don't want to change this function directly (I mean, edit or put comments in wpmu-functions.php), because I want to be able to update the WordPress without care about any hard code.

    Thank you guys!

    Posted 1 year ago #
  2. With wp ms 3.0, It is very easy.
    You will need to override
    "wp_install_defaults" not the "install_blog_defaults"

    To override, copy this function "wp_install_defaults" from wp-admin/includes/upgrade.php and put it in a plugin file.Do not change the name, but you can manipulate the content as you want.

    Activate the plugin sitewide and you are done.
    Hope that helps.

    Posted 1 year ago #
  3. Hi Brajesh,

    Firstly, thank you for your help.

    Currently, I'm running WordPress 2.9.2 and unfortunately I can't upgrade the WordPress now.

    I tried to override the function "wp_install_defaults", following your instructions, but it didn't work. I didn't get any error, but the WordPress still posting automatically the "hello world" post and comment.

    I also tried to override the function "install_blog_defaults", but if I copy this function and put it in a plugin file, then I get a blank screen.

    Do you know another way to disable the "hello word" post and comment without change the original WordPress source code?

    Thank you.

    Posted 1 year ago #

Reply

You must log in to post.