* Holds the plugin experiments manager.
* @var Experiments_Manager
* Holds the plugin uploads manager responsible for handling file uploads
* that are not done with WordPress Media.
* Holds the plugin breakpoints manager.
* @var Breakpoints_Manager
* Holds the plugin assets loader responsible for conditionally enqueuing
* styles and script assets that were pre-enabled.
* Container instance for managing dependencies.
* Disable class cloning and throw an error on object clone.
* The whole idea of the singleton design pattern is that there is a single
* object. Therefore, we don't want the object to be cloned.
public function __clone() {
sprintf( 'Cloning instances of the singleton "%s" class is forbidden.', get_class( $this ) ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
* Disable unserializing of the class.
public function __wakeup() {
sprintf( 'Unserializing instances of the singleton "%s" class is forbidden.', get_class( $this ) ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
* Ensures only one instance of the plugin class is loaded or can be loaded.
* @return Plugin An instance of the class.
public static function instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
* Fires when Elementor was fully loaded and instantiated.
do_action( 'elementor/loaded' );
public function initialize_container() {
Container::initialize_instance();
$this->container = Container::get_instance();
* Get the Elementor container or resolve a dependency.
* @param string|null $dependency The dependency to resolve. If null, returns the container instance.
* @return mixed The container instance or the resolved dependency.
* @throws \InvalidArgumentException The name parameter must be of type string.
* @throws DependencyException Error while resolving the entry.
* @throws NotFoundException No entry found for the given name.
public function elementor_container( $dependency = null ) {
if ( is_null( $dependency ) ) {
return $this->container->make( $dependency );
* Initialize Elementor Plugin. Register Elementor support for all the
* supported post types and initialize Elementor components.
$this->add_cpt_support();
$this->init_components();
* Fires when Elementor components are initialized.
* After Elementor finished loading but before any headers are sent.
do_action( 'elementor/init' );
* Retrieve the time when Elementor was installed.
* @return int Unix timestamp when Elementor was installed.
public function get_install_time() {
$installed_time = get_option( '_elementor_installed_time' );
if ( ! $installed_time ) {
$installed_time = time();
update_option( '_elementor_installed_time', $installed_time );
public function on_rest_api_init() {
// On admin/frontend sometimes the rest API is initialized after the common is initialized.
* Initialize Elementor components. Register actions, run setting manager,
* initialize all the components that run elementor, and if in admin page
* initialize admin components.
private function init_components() {
$this->experiments = new Experiments_Manager();
$this->breakpoints = new Breakpoints_Manager();
$this->inspector = new Inspector();
$this->controls_manager = new Controls_Manager();
$this->documents = new Documents_Manager();
$this->kits_manager = new Kits_Manager();
$this->elements_manager = new Elements_Manager();
$this->widgets_manager = new Widgets_Manager();
$this->skins_manager = new Skins_Manager();
$this->files_manager = new Files_Manager();
$this->assets_manager = new Assets_Manager();
$this->icons_manager = new Icons_Manager();
$this->settings = new Settings();
$this->tools = new Tools();
$this->editor = new Editor();
$this->preview = new Preview();
$this->frontend = new Frontend();
$this->maintenance_mode = new Maintenance_Mode();
$this->dynamic_tags = new Dynamic_Tags_Manager();
$this->modules_manager = new Modules_Manager();
$this->templates_manager = new TemplateLibrary\Manager();
$this->role_manager = new Core\RoleManager\Role_Manager();
$this->system_info = new System_Info_Module();
$this->revisions_manager = new Revisions_Manager();
$this->images_manager = new Images_Manager();
$this->wp = new Wp_Api();
$this->assets_loader = new Assets_Loader();
$this->uploads_manager = new Uploads_Manager();
$this->admin_menu_manager = new Admin_Menu_Manager();
$this->admin_menu_manager->register_actions();
$this->upgrade = new Core\Upgrade\Manager();
$this->custom_tasks = new Core\Upgrade\Custom_Tasks_Manager();
$this->app = new App\App();
$this->heartbeat = new Heartbeat();
$this->wordpress_widgets_manager = new WordPress_Widgets_Manager();
$this->admin = new Admin();
$this->beta_testers = new Beta_Testers();
public function init_common() {
$this->common = new CommonApp();
$this->common->init_components();
* Add custom post type support.
* Register Elementor support for all the supported post types defined by
* the user in the admin screen and saved as `elementor_cpt_support` option
* in WordPress `$wpdb->options` table.
* If no custom post type selected, usually in new installs, this method
* will return the two default post types: `page` and `post`.
private function add_cpt_support() {
$cpt_support = get_option( 'elementor_cpt_support', self::ELEMENTOR_DEFAULT_POST_TYPES );
foreach ( $cpt_support as $cpt_slug ) {
add_post_type_support( $cpt_slug, 'elementor' );
* Elementor autoloader loads all the classes needed to run the plugin.
private function register_autoloader() {
require_once ELEMENTOR_PATH . '/includes/autoloader.php';
* Magic getter for accessing certain properties.
* @param string $property The property name.
* @return mixed The property value or null if not found.
* @throws \Exception If trying to access a private property.
public function __get( $property ) {
if ( 'posts_css_manager' === $property ) {
self::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_argument( 'Plugin::$instance->posts_css_manager', '2.7.0', 'Plugin::$instance->files_manager' );
return $this->files_manager;
if ( 'data_manager' === $property ) {
return Data_Manager::instance();
if ( property_exists( $this, $property ) ) {
throw new \Exception( 'Cannot access private property.' );
* Initializing Elementor plugin.
private function __construct() {
$this->register_autoloader();
$this->logger = Log_Manager::instance();
$this->data_manager_v2 = Data_Manager_V2::instance();
Compatibility::register_actions();
add_action( 'init', [ $this, 'init' ], 0 );
add_action( 'rest_api_init', [ $this, 'on_rest_api_init' ], 9 );
final public static function get_title() {
return esc_html__( 'Elementor', 'elementor' );
if ( ! defined( 'ELEMENTOR_TESTS' ) ) {
// In tests we run the instance manually.
$plugin_instance = Plugin::instance();
$plugin_instance->initialize_container();