Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

KW923 on "Security Question: SQL Injections"

$
0
0

Hi,

I have heard about the importance of properly sanitizing or preparing SQL Queries while developing plugins. I'm just not sure if I understand how to do it. I've created my query which takes the page titles and flushes them from the database. The plugin is supposed to allow the user to create new page titles in a custom form by using wp_insert_post.

How do I sanitize/validate the page title input that will be sent to the database?

global $wpdb;
	$args['menu_order'] = $wpdb->get_var("SELECT MAX(menu_order)+1 AS menu_order FROM {$wpdb->posts} WHERE post_type='page'");
	$wpdb->flush();

Viewing all articles
Browse latest Browse all 8245

Trending Articles