Skip to content

Commit 6c1dd8d

Browse files
rodrigoprimojrfnl
andcommitted
Apply suggestions from code review
Co-authored-by: Juliette <663378+jrfnl@users.noreply.github.com>
1 parent 585ebfc commit 6c1dd8d

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

WordPress/Docs/DB/SlowDBQueryStandard.xml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,26 @@
1111
<code_comparison>
1212
<code title="Valid: No potentially slow query keys.">
1313
<![CDATA[
14-
$args = array(
14+
$query = new WP_Query( array(
1515
'post_type' => 'post',
16-
);
16+
) );
1717
1818
19-
$query = 'post_type=post&orderby=date';
19+
$posts = get_posts(
20+
'post_type=post&orderby=date'
21+
);
2022
]]>
2123
</code>
2224
<code title="Invalid: Using potentially slow query keys.">
2325
<![CDATA[
24-
$args = array(
26+
$query = new WP_Query( array(
2527
'<em>meta_key</em>' => 'color',
2628
'<em>meta_value</em>' => 'blue',
27-
);
29+
) );
2830
29-
$query = 'post_type=post&<em>meta_key</em>=featured';
31+
$posts = get_posts(
32+
'post_type=post&<em>meta_key</em>=featured'
33+
);
3034
]]>
3135
</code>
3236
</code_comparison>

0 commit comments

Comments
 (0)