Esc_attr () (Filter properties)
It is generally written in the following format when writing the tag attributes of the Html code:
What if the Value property is dynamic output?
However, if the dynamic output attributes include double quotes, angle brackets, and other special characters, the Html code will be scrambled, then you can use the esc_attr () function to escape the output properties.
How to use
Esc_attr ($text);
Parameters
$text (String) (must) the string to be escaped. Default value: None
return value
Returns the escaped string.
Example
Other
This function is located at: wp-includes/formatting.php
Esc_sql () (Filter SQL statements)
Esc_sql () is used to filter the strings that are prepared to be added to the SQL statement, preventing SQL injection and SQL statements from being disturbed by data.
Usage
Esc_sql ($data);
Parameters
$data
(string) (must) the string to filter.
Default value: None
return value
(string) returns the filtered string, which can be added directly to the SQL statement.
Example
$name = Esc_sql ($name); $status = Esc_sql ($status); $wpdb->get_var ("Select something from table WHERE foo = ' $name ' and status = ' $status ');
More
This function is located at: wp-includes/formatting.php
The above describes the WordPress development in the filtering properties and SQL statement function use, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.