__get_option() – Utility version of get_option that is private to installation/upgrade.

You appear to be a bot. Output may be restricted

Description

Utility version of get_option that is private to installation/upgrade.

Usage

$mixed = __get_option( $setting );

Parameters

$setting
( string ) required – Option name.

Returns

mixed

Source

File name: wordpress/wp-admin/includes/upgrade.php
Lines:

1 to 23 of 23
function __get_option( $setting ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
  global $wpdb;

  if ( 'home' === $setting && defined( 'WP_HOME' ) ) {
    return untrailingslashit( WP_HOME );
  }

  if ( 'siteurl' === $setting && defined( 'WP_SITEURL' ) ) {
    return untrailingslashit( WP_SITEURL );
  }

  $option = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s", $setting ) );

  if ( 'home' === $setting && ! $option ) {
    return __get_option( 'siteurl' );
  }

  if ( in_array( $setting, array( 'siteurl', 'home', 'category_base', 'tag_base' ), true ) ) {
    $option = untrailingslashit( $option );
  }

  return maybe_unserialize( $option );
}
 

 View on GitHub View on Trac