Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WordPress SQLite Integration Extensions and Fixes
<?php
/*
Plugin Name: SQLite Query Fixes
Description: Custom SQLite Fixes for Wordpress and SQLite Integration
Author: Christopher Zenzel
Version: 1.0
*/
add_filter('query', 'czwp_sqlite_query');
function czwp_sqlite_query($query) {
$query = czwp_sqlite_options($query);
return $query;
}
function czwp_sqlite_options($query) {
$query_lower = strtolower($query);
$detect = 0;
$detect += strpos( $query_lower, 'update' );
$detect += strpos( $query_lower, 'wp_options' );
$detect += strpos( $query_lower, 'null' );
if ($detect >= 3) {
$query = str_ireplace('NULL', "''", $query);
}
return $query;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.