'h23pf_form', 'post_status' => 'any', 'numberposts' => -1, 'fields' => 'ids', ) ); foreach ( $forms as $form_id ) { wp_delete_post( $form_id, true ); } // Product and category settings (features, forms, quantity rules). // The data saved on orders (_h23pf_extra*) is kept: on the classic order storage it lives in postmeta too. $like = $wpdb->esc_like( '_h23pf_' ) . '%'; $order_like = $wpdb->esc_like( '_h23pf_extra' ) . '%'; // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- removes the plugin's own data on uninstall. $wpdb->query( $wpdb->prepare( 'DELETE FROM %i WHERE meta_key LIKE %s AND meta_key NOT LIKE %s', $wpdb->postmeta, $like, $order_like ) ); $wpdb->query( $wpdb->prepare( 'DELETE FROM %i WHERE meta_key LIKE %s', $wpdb->termmeta, $like ) ); // phpcs:enable delete_option( 'h23pf_settings' ); wp_cache_flush(); } if ( is_multisite() ) { foreach ( get_sites( array( 'fields' => 'ids', 'number' => 0, ) ) as $h23pf_site_id ) { switch_to_blog( $h23pf_site_id ); h23pf_uninstall_site(); restore_current_blog(); } } else { h23pf_uninstall_site(); }