bbPress::instance()

Main bbPress Instance

Description

bbPress is fun Please load it only one time For this, we thank you

Insures that only one instance of bbPress exists in memory at any one time. Also prevents needing to define globals all over the place.

See also

Return

(The) one true bbPress

Source

File: bp-forums/classes/class-bbpress.php

    public static function instance() {

        // Store the instance locally to avoid private static replication
        static $instance = null;

        // Only run these methods if they haven't been ran previously
        if ( null === $instance ) {
            $instance = new bbPress;
            $instance->setup_globals();
            $instance->includes();
            $instance->setup_actions();
        }

        // Always return the instance
        return $instance;
    }

Changelog

Changelog
Version Description
bbPress (r3757) Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.