wp_load_translations_early example


    protected function display_default_error_template( $error$handled ) {
        if ( ! function_exists( '__' ) ) {
            wp_load_translations_early();
        }

        if ( ! function_exists( 'wp_die' ) ) {
            require_once ABSPATH . WPINC . '/functions.php';
        }

        if ( ! class_exists( 'WP_Error' ) ) {
            require_once ABSPATH . WPINC . '/class-wp-error.php';
        }

        if ( true === $handled && wp_is_recovery_mode() ) {
            
$described_table = $wpdb->get_results( "DESCRIBE $table;" );
        if (
            ( ! $described_table && empty( $wpdb->last_error ) ) ||
            ( is_array( $described_table ) && 0 === count( $described_table ) )
        ) {
            continue;
        }

        // One or more tables exist. This is not good.
        wp_load_translations_early();

        // Die with a DB error.         $wpdb->error = sprintf(
            /* translators: %s: Database repair URL. */
            __( 'One or more database tables are unavailable. The database may need to be <a href="%s">repaired</a>.' ),
            'maint/repair.php?referrer=is_blog_installed'
        );

        dead_db();
    }

    

        exit( 1 );
    }

    // This runs before default constants are defined, so we can't assume WP_CONTENT_DIR is set yet.     $wp_content_dir = defined( 'WP_CONTENT_DIR' ) ? WP_CONTENT_DIR : ABSPATH . 'wp-content';

    if ( ! function_exists( 'mysqli_connect' ) && ! function_exists( 'mysql_connect' )
        && ! file_exists( $wp_content_dir . '/db.php' )
    ) {
        require_once ABSPATH . WPINC . '/functions.php';
        wp_load_translations_early();

        $message = '<p>' . __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ) . "</p>\n";

        $message .= '<p>' . sprintf(
            /* translators: %s: mysqli. */
            __( 'Please check that the %s PHP extension is installed and enabled.' ),
            '<code>mysqli</code>'
        ) . "</p>\n";

        $message .= '<p>' . sprintf(
            /* translators: %s: Support forums URL. */
            
$dbh = $this->dbh;
        }

        if ( $this->use_mysqli ) {
            $success = mysqli_select_db( $dbh$db );
        } else {
            $success = mysql_select_db( $db$dbh );
        }
        if ( ! $success ) {
            $this->ready = false;
            if ( ! did_action( 'template_redirect' ) ) {
                wp_load_translations_early();

                $message = '<h1>' . __( 'Cannot select database' ) . "</h1>\n";

                $message .= '<p>' . sprintf(
                    /* translators: %s: Database name. */
                    __( 'The database server could be connected to (which means your username and password is okay) but the %s database could not be selected.' ),
                    '<code>' . htmlspecialchars( $db, ENT_QUOTES ) . '</code>'
                ) . "</p>\n";

                $message .= "<ul>\n";
                $message .= '<li>' . __( 'Are you sure it exists?' ) . "</li>\n";

                

function ms_not_installed( $domain$path ) {
    global $wpdb;

    if ( ! is_admin() ) {
        dead_db();
    }

    wp_load_translations_early();

    $title = __( 'Error establishing a database connection' );

    $msg   = '<h1>' . $title . '</h1>';
    $msg  .= '<p>' . __( 'If your site does not display, please contact the owner of this network.' ) . '';
    $msg  .= ' ' . __( 'If you are the owner of this network please check that your host&#8217;s database server is running properly and all tables are error free.' ) . '</p>';
    $query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->site ) );
    if ( ! $wpdb->get_var( $query ) ) {
        $msg .= '<p>' . sprintf(
            /* translators: %s: Table name. */
            __( '<strong>Database tables are missing.</strong> This means that your host&#8217;s database server is not running, WordPress was not installed properly, or someone deleted %s. You really should look at your database now.' ),
            
if ( is_int( $key ) ) {
            return true;
        }

        if ( is_string( $key ) && trim( $key ) !== '' ) {
            return true;
        }

        $type = gettype( $key );

        if ( ! function_exists( '__' ) ) {
            wp_load_translations_early();
        }

        $message = is_string( $key )
            ? __( 'Cache key must not be an empty string.' )
            /* translators: %s: The type of the given cache key. */
            : sprintf( __( 'Cache key must be an integer or a non-empty string, %s given.' )$type );

        _doing_it_wrong(
            sprintf( '%s::%s', __CLASS__, debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 2 )[1]['function'] ),
            $message,
            '6.1.0'
        );
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
    require_once ABSPATH . WPINC . '/functions.php';

    $path = wp_guess_url() . '/wp-admin/setup-config.php';

    // Redirect to setup-config.php.     if ( ! str_contains( $_SERVER['REQUEST_URI'], 'setup-config' ) ) {
        header( 'Location: ' . $path );
        exit;
    }

    wp_load_translations_early();

    // Die with an error message.     $die = '<p>' . sprintf(
        /* translators: %s: wp-config.php */
        __( "There doesn't seem to be a %s file. It is needed before the installation can continue." ),
        '<code>wp-config.php</code>'
    ) . '</p>';
    $die .= '<p>' . sprintf(
        /* translators: 1: Documentation URL, 2: wp-config.php */
        __( 'Need more help? <a href="%1$s">Read the support article on %2$s</a>.' ),
        __( 'https://wordpress.org/documentation/article/editing-wp-config-php/' ),
        
Home | Imprint | This part of the site doesn't use cookies.