Skip to content

Commit 753f914

Browse files
committed
Apply suggestions from code review and a few other changes
1 parent 622faf6 commit 753f914

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

WordPress/Docs/DB/RestrictedFunctionsStandard.xml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,47 +5,47 @@
55
>
66
<standard>
77
<![CDATA[
8-
Avoid touching the database directly with PHP library functions. Use the $wpdb object and associated functions instead.
8+
Avoid touching the database directly with PHP library functions. Use the $wpdb object and associated functions instead.
99
]]>
1010
</standard>
1111
<code_comparison>
12-
<code title="Invalid: Using MySQLi library to fetch posts">
13-
<![CDATA[
14-
$results = <em>mysqli_query</em>(
15-
$mysql,
16-
"SELECT * FROM wp_posts LIMIT 5"
17-
);
18-
]]>
19-
</code>
20-
<code title="Valid: Use WordPress functions">
12+
<code title="Valid: Using a WordPress function to fetch posts.">
2113
<![CDATA[
2214
$results = <em>get_posts()</em>;
2315
]]>
2416
</code>
25-
</code_comparison>
26-
<code_comparison>
27-
<code title="Invalid: Using MySQLi library to insert a post">
17+
<code title="Invalid: Using the MySQLi library to fetch posts.">
2818
<![CDATA[
29-
<em>mysqli_query</em>(
19+
$results = <em>mysqli_query</em>(
3020
$mysql,
31-
"INSERT INTO wp_posts (post_title)
32-
VALUES ('Title')"
21+
"SELECT * FROM wp_posts LIMIT 5"
3322
);
3423
]]>
3524
</code>
36-
<code title="Valid: Use WordPress functions">
25+
</code_comparison>
26+
<code_comparison>
27+
<code title="Valid: Using WordPress functions to insert a post">
3728
<![CDATA[
38-
<em>wp_insert_post</em>(
29+
<em>wp_insert_post</em>(
3930
array( 'post_title' => 'Title' )
4031
);
4132
4233
// or...
4334
4435
global $wpdb;
45-
<em>$wpdb->insert</em>(
36+
<em>$wpdb->insert</em>(
4637
"{$wpdb->prefix}_posts",
4738
array( 'post_title' => 'Title' ),
48-
array( '%s' )
39+
array( '%s' )
40+
);
41+
]]>
42+
</code>
43+
<code title="Invalid: Using MySQLi library to insert a post">
44+
<![CDATA[
45+
<em>mysqli_query</em>(
46+
$mysql,
47+
"INSERT INTO wp_posts (post_title)
48+
VALUES ('Title')"
4949
);
5050
]]>
5151
</code>

0 commit comments

Comments
 (0)