On WP2Static 7.2, the following notice appears above the Addons page :
Notice: Function wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder. Please see [Debugging in WordPress](https://wordpress.org/support/article/debugging-in-wordpress/) for more information. (This message was added in version 3.9.0.) in /var/www/html/wp-includes/functions.php on line 5835
This is due to Addons.php (line 53) file building a query string without a %s placeholder in the case where $type === 'all'
public static function getAll( string $type = 'all' ) : array {
global $wpdb;
$table_name = $wpdb->prefix . 'wp2static_addons';
$query_string = "SELECT * FROM $table_name";
$query_params = [];
if ( $type !== 'all' ) {
$query_string .= ' WHERE type = %s';
$query_params[] = $type;
}
$query_string .= ' ORDER BY type DESC';
return $wpdb->get_results(
$wpdb->prepare( $query_string, $query_params )
);
}
To Reproduce
Steps to reproduce the behavior:
Go to Addons page (with debug mode on)
See notice
Expected behavior
No notice should appear on the Addons page
Screenshots
Environment (please complete the following information):
Describe the bug
On WP2Static 7.2, the following notice appears above the Addons page :
This is due to Addons.php (line 53) file building a query string without a
%s
placeholder in the case where$type === 'all'
To Reproduce Steps to reproduce the behavior:
Expected behavior No notice should appear on the Addons page
Screenshots
Environment (please complete the following information):