Skip to content

Commit 2a8fc57

Browse files
rodrigoprimojrfnl
andcommitted
Apply suggestions from code review
Co-authored-by: Juliette <663378+jrfnl@users.noreply.github.com>
1 parent 910738f commit 2a8fc57

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

WordPress/Docs/DB/DirectDatabaseQueryStandard.xml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
>
66
<standard>
77
<![CDATA[
8-
Direct database queries using $wpdb methods should be avoided. WordPress database abstraction layers handle caching, data integrity, and firing of hooks, which direct queries bypass.
8+
Direct database queries using WPDB class methods should be avoided. WordPress database abstraction layers handle caching, data integrity, and firing of hooks, which direct queries bypass.
99
]]>
1010
</standard>
1111
<code_comparison>
@@ -103,7 +103,22 @@ function update_post_title() {
103103
</code_comparison>
104104
<standard>
105105
<![CDATA[
106-
Altering the database schema is discouraged, as it can break WordPress core, plugins, or themes that depend on the existing schema.
106+
Altering the database schema using ALTER, CREATE, or DROP statements is discouraged, as it can break WordPress core, plugins, or themes that depend on the existing schema.
107107
]]>
108108
</standard>
109+
<code_comparison>
110+
<code title="Valid: Not altering the database schema.">
111+
<![CDATA[
112+
// Do not use ALTER, CREATE, or DROP.
113+
]]>
114+
</code>
115+
<code title="Invalid: Altering the database schema.">
116+
<![CDATA[
117+
$wpdb->query(
118+
"<em>ALTER</em> TABLE {$wpdb->posts}
119+
ADD COLUMN rating int"
120+
);
121+
]]>
122+
</code>
123+
</code_comparison>
109124
</documentation>

0 commit comments

Comments
 (0)