Last active
September 27, 2019 11:51
-
-
Save czenzel/2fc95098f61b7fd8714717ddaee80089 to your computer and use it in GitHub Desktop.
WordPress SQLite Integration Extensions and Fixes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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