wpseek.com
A WordPress-centric search engine for devs and theme authors
wp_parse_args › WordPress Function
Since2.2.0
Deprecatedn/a
› wp_parse_args ( $args, $defaults = array() )
| Parameters: (2) |
|
| Returns: |
|
| Defined at: |
|
| Codex: | |
| Change Log: |
|
Merges user defined arguments into defaults array.
This function is used throughout WordPress to allow for both string or array to be merged into another array.Source
function wp_parse_args( $args, $defaults = array() ) {
if ( is_object( $args ) ) {
$parsed_args = get_object_vars( $args );
} elseif ( is_array( $args ) ) {
$parsed_args =& $args;
} else {
wp_parse_str( $args, $parsed_args );
}
if ( is_array( $defaults ) && $defaults ) {
return array_merge( $defaults, $parsed_args );
}
return $parsed_args;
}