How to prevent SQL Injection in Wordpress?

后端 未结 1 520
不思量自难忘°
不思量自难忘° 2020-12-19 05:53

I\'m currently using the following query to get values in mysql using php:

The code is working, but now I\'m worried about sql injections.

How to prevent SQL

1条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-19 06:02

    From the WordPress Codex on protecting queries against SQL Injection attacks:

    prepare( 'query' , value_parameter[, value_parameter ... ] ); ?>
    

    If you scroll down a bit farther, there are examples.

    You should also read the database validation docs for a more thorough overview of SQL escaping in WordPress.

    0 讨论(0)
提交回复
热议问题