WP_Theme_JSON_Schema::unset_setting_by_path() – Removes a property from within the provided settings by its path.

You appear to be a bot. Output may be restricted

Description

Removes a property from within the provided settings by its path.

Usage

$void = WP_Theme_JSON_Schema::unset_setting_by_path( $settings, $path );

Parameters

$settings
( array ) required – Reference to the current settings array.
$path
( array ) required – Path to the property to be removed.

Returns

void

Source

File name: wordpress/wp-includes/class-wp-theme-json-schema.php
Lines:

1 to 9 of 9
  private static function unset_setting_by_path( &$settings, $path ) {
    $tmp_settings = &$settings; // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
    $last_key     = array_pop( $path );
    foreach ( $path as $key ) {
      $tmp_settings = &$tmp_settings[ $key ];
    }

    unset( $tmp_settings[ $last_key ] );
  }
 

 View on GitHub View on Trac