Inventory_Presser_Order_By_Widget::update( array $new_instance, array $old_instance )
Saves the widget settings when a dashboard user clicks the Save button.
On This Page
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'] = wp_strip_all_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 ] = wp_strip_all_tags( wp_unslash( $_REQUEST[ 'obpm-label-' . $key ] ) );
}
} else {
unset( $instance[ 'label-' . $key ] );
}
}
$instance['post-meta-keys'] = implode( '|', $keys );
return $instance;
}
Expand full source codeCollapse full source codeView on Github