Automattic\WooCommerce\Admin\RemoteInboxNotifications
RemoteInboxNotificationsEngine::ajax_action_inbox_notification_search
Add ajax action for remote inbox notification search.
Method of the class: RemoteInboxNotificationsEngine{}
No Hooks.
Returns
null
. Nothing (null).
Usage
$result = RemoteInboxNotificationsEngine::ajax_action_inbox_notification_search();
RemoteInboxNotificationsEngine::ajax_action_inbox_notification_search() RemoteInboxNotificationsEngine::ajax action inbox notification search code WC 9.9.5
public static function ajax_action_inbox_notification_search() { global $wpdb; check_ajax_referer( 'search-products', 'security' ); if ( ! isset( $_GET['term'] ) ) { wp_send_json( array() ); } $search = wc_clean( sanitize_text_field( wp_unslash( $_GET['term'] ) ) ); $results = $wpdb->get_results( $wpdb->prepare( "SELECT note_id, name FROM {$wpdb->prefix}wc_admin_notes WHERE name LIKE %s", '%' . $wpdb->esc_like( $search ) . '%' ) ); $rows = array(); foreach ( $results as $result ) { $rows[ $result->note_id ] = $result->name; } wp_send_json( $rows ); }