Support » Plugins » Hacks » First plugin

  • Hello,

    currently developing my first plugin.. pretty much done.

    However i would like to include wordpress functions within my plugins do i simply include wp-load.php are is there a better option?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Your plugin should be called only after that file is included, so you should be able to use WP functions without including anything else. What function specifically do you want to use?

    trying to use get_blog_list and the likes of is_main_site

    Moderator bcworkz


    You really should find a different way than use get_blog_list(). It is depreciated and could disappear from an upgrade at any time. As halferdev said, you should be able to call is_main_site() or any other WP function without including anything because your plugin code is typically hooked into a filter or action. Thus the WP environment is already loaded for the filter or action to fire. Since your code is called from WP, you have access to the functions, objects, etc.

    The one reason to include wp-load.php is if you have a separate file that is requested via a browser link that needs to interface with WP. Since this starts a new process, you would initiate the WP environment by including wp-load.php.

    Ok thanks for the replies and advice. I’ll have another look into it.

    I wasn’t aware get_blog_list has been depreciated.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘First plugin’ is closed to new replies.