Extracts a slice of an array, given a list of keys.
Parameters
$input_array
arrayrequired- The original array.
$keys
arrayrequired- The list of keys.
Return
array The array slice.Source
function wp_array_slice_assoc( $input_array, $keys ) {
$slice = array();
foreach ( $keys as $key ) {
if ( isset( $input_array[ $key ] ) ) {
$slice[ $key ] = $input_array[ $key ];
}
}
return $slice;
}
Related
Used by | Description |
---|---|
WP_Term_Query::generate_cache_key()wp-includes/class-wp-term-query.php | Generate cache key. |
wp_list_users()wp-includes/user.php | Lists all the users of the site, with several options available. |
wp_get_code_editor_settings()wp-includes/general-template.php | Generates and returns code editor settings. |
WP_Widget_Media_Gallery::enqueue_admin_scripts()wp-includes/widgets/class-wp-widget-media-gallery.php | Loads the required media files for the media manager and scripts for media widgets. |
WP_Widget_Media_Audio::enqueue_admin_scripts()wp-includes/widgets/class-wp-widget-media-audio.php | Loads the required media files for the media manager and scripts for media widgets. |
WP_Widget_Media_Video::enqueue_admin_scripts()wp-includes/widgets/class-wp-widget-media-video.php | Loads the required scripts and styles for the widget control. |
WP_Widget_Media::form()wp-includes/widgets/class-wp-widget-media.php | Outputs the settings update form. |
WP_Widget_Media_Image::enqueue_admin_scripts()wp-includes/widgets/class-wp-widget-media-image.php | Loads the required media files for the media manager and scripts for media widgets. |
WP_Customize_Manager::import_theme_starter_content()wp-includes/class-wp-customize-manager.php | Imports theme starter content into the customized state. |
get_theme_starter_content()wp-includes/theme.php | Expands a theme’s starter content configuration using core-provided data. |
WP_Network_Query::get_networks()wp-includes/class-wp-network-query.php | Gets a list of networks matching the query vars. |
WP_Site_Query::get_sites()wp-includes/class-wp-site-query.php | Retrieves a list of sites matching the query vars. |
WP_Customize_Manager::set_autofocus()wp-includes/class-wp-customize-manager.php | Sets the autofocused constructs. |
WP_Comment_Query::get_comment_ids()wp-includes/class-wp-comment-query.php | Used internally to get a list of comment IDs matching the query vars. |
WP_Comment_Query::fill_descendants()wp-includes/class-wp-comment-query.php | Fetch descendants for located comments. |
WP_Customize_Nav_Menu_Setting::sanitize()wp-includes/customize/class-wp-customize-nav-menu-setting.php | Sanitize an input. |
WP_Customize_Nav_Menu_Setting::update()wp-includes/customize/class-wp-customize-nav-menu-setting.php | Create/update the nav_menu term for this setting. |
WP_Customize_Nav_Menu_Setting::value()wp-includes/customize/class-wp-customize-nav-menu-setting.php | Get the instance data for a given widget setting. |
WP_Customize_Nav_Menu_Item_Setting::sanitize()wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Sanitize an input. |
WP_Comment_Query::get_comments()wp-includes/class-wp-comment-query.php | Get a list of comments matching the query vars. |
WP_Customize_Panel::json()wp-includes/class-wp-customize-panel.php | Gather the parameters passed to client JavaScript via JSON. |
WP_Customize_Section::json()wp-includes/class-wp-customize-section.php | Gather the parameters passed to client JavaScript via JSON. |
_wp_customize_include()wp-includes/theme.php | Includes and instantiates the WP_Customize_Manager class. |
wp_dropdown_users()wp-includes/user.php | Creates dropdown HTML content of users. |
wp_list_authors()wp-includes/author-template.php | Lists all the authors of the site, with several options available. |
wp_update_comment()wp-includes/comment.php | Updates an existing comment in the database. |
Changelog
Version | Description |
---|---|
3.1.0 | Introduced. |
This will return an associative array with only the key/value pairs that you need.