Inventory_Presser_Order_By_Widget::update( array $new_instance, array $old_instance )
update
Contents
Description Description
Saves the widget settings when a dashboard user clicks the Save button.
Parameters Parameters
- $new_instance
-
(array) (Required)
- $old_instance
-
(array) (Required)
Return Return
(array) The updated array full of settings
Source Source
File: includes/widget/class-widget-order-by.php
public function update( $new_instance, $old_instance ) { $instance = array(); $instance['title'] = strip_tags( $new_instance['title'] ); $keys = array(); foreach ( INVP::keys() as $key ) { $key = apply_filters( 'invp_prefix_meta_key', $key ); if ( isset( $_REQUEST[ 'obpm-key-' . $key ] ) ) { array_push( $keys, $key ); if ( isset( $_REQUEST[ 'obpm-label-' . $key ] ) ) { $instance[ 'label-' . $key ] = strip_tags( $_REQUEST[ 'obpm-label-' . $key ] ); } } else { unset( $instance[ 'label-' . $key ] ); } } $instance['post-meta-keys'] = implode( '|', $keys ); return $instance; }
Expand full source code Collapse full source code View on Github