wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema



add_allowed_options › WordPress Function

Desde5.5.0
Obsoleton/a
add_allowed_options ( $new_options, $options = '' )
Parâmetros: (2)
  • (array) $new_options
    Required: Yes
  • (string|array) $options
    Required: No
    Padrão: (empty)
Retorna:
  • (array)
Definido em:
Codex:

Adds an array of options to the list of allowed options.



Fonte

function add_allowed_options( $new_options, $options = '' ) {
	if ( '' === $options ) {
		global $allowed_options;
	} else {
		$allowed_options = $options;
	}

	foreach ( $new_options as $page => $keys ) {
		foreach ( $keys as $key ) {
			if ( ! isset( $allowed_options[ $page ] ) || ! is_array( $allowed_options[ $page ] ) ) {
				$allowed_options[ $page ]   = array();
				$allowed_options[ $page ][] = $key;
			} else {
				$pos = array_search( $key, $allowed_options[ $page ], true );
				if ( false === $pos ) {
					$allowed_options[ $page ][] = $key;
				}
			}
		}
	}

	return $allowed_options;
}