• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress core a2z

WordPress core a2z

WordPress core only

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / Theme_Upgrader::current_before() – Turn on maintenance mode before attempting to upgrade the current theme.

You appear to be a bot. Output may be restricted

Description

Turn on maintenance mode before attempting to upgrade the current theme.

Hooked to the upgrader_pre_install filter by Theme_Upgrader::upgrade() and Theme_Upgrader::bulk_upgrade().

Usage

$bool|WP_Error = Theme_Upgrader::current_before( $return, $theme );

Parameters

$return
( bool|WP_Error ) required – Upgrade offer return.
$theme
( array ) required – Theme arguments.

Returns

bool|WP_Error The passed in $return param or WP_Error.

Source

File name: wordpress/wp-admin/includes/class-theme-upgrader.php
Lines:

1 to 19 of 19
  public function current_before( $return, $theme ) {
    if ( is_wp_error( $return ) ) {
      return $return;
    }

    $theme = isset( $theme['theme'] ) ? $theme['theme'] : '';

    // Only run if current theme
    if ( get_stylesheet() !== $theme ) {
      return $return;
    }

    // Change to maintenance mode. Bulk edit handles this separately.
    if ( ! $this->bulk ) {
      $this->maintenance_mode( true );
    }

    return $return;
  }
 

 View on GitHub View on Trac

Published: 25th November 2019 | Last updated: 2nd April 2020

Primary Sidebar

Information

Function name: Theme_Upgrader::current_before
Class ref: Theme_Upgrader
Plugin ref: WordPress
Version: 5.6
Sourcefile: wp-admin/includes/class-theme-upgrader.php
File ref: wp-admin/includes/class-theme-upgrader.php
Deprecated?: No
API Letters: B,C,T,U

Footer

WP-a2z
WordPress core a2z
WordPress core only
WordPress 5.6
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  core.wp-a2z.org
© Copyright WP-a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites