Skip to content

Commit 38c7443

Browse files
committed
Apply suggestions from code review and made a few more small changes
1 parent a371efb commit 38c7443

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

WordPress/Docs/WP/DiscouragedConstantsStandard.xml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,41 @@
55
>
66
<standard>
77
<![CDATA[
8-
The use of certain WordPress constants is discouraged. Examples include `TEMPLATEPATH` and `STYLESHEETPATH`.
8+
The use of certain WordPress native constants is discouraged. Use the recommended alternatives instead.
99
]]>
1010
</standard>
1111
<code_comparison>
12-
<code title="Valid: Function used instead of constant.">
12+
<code title="Valid: Function used instead of discouraged WP constant.">
1313
<![CDATA[
14-
$subdir = <em>get_template_directory()</em> . '/subdir';
14+
$dir = <em>get_stylesheet_directory()</em>;
1515
]]>
1616
</code>
17-
<code title="Invalid: The TEMPLATEPATH constant is used in the code.">
17+
<code title="Invalid: Discouraged WP constant is used.">
1818
<![CDATA[
19-
$subdir = <em>TEMPLATEPATH</em> . '/subdir';
19+
$dir = <em>STYLESHEETPATH</em>;
2020
]]>
2121
</code>
2222
</code_comparison>
2323
<standard>
2424
<![CDATA[
25-
The use of certain WordPress constants is discouraged. Examples include `TEMPLATEPATH` and `STYLESHEETPATH`.
25+
The (re-)declaration of certain WordPress native constants is discouraged. Use the recommended alternatives instead.
2626
]]>
2727
</standard>
2828
<code_comparison>
29-
<code title="Valid: Function used instead of constant.">
29+
<code title="Valid: Using recommended alternative instead of (re-)declaring WP constant.">
3030
<![CDATA[
31-
$dir = <em>get_stylesheet_directory()</em>;
31+
<em>add_theme_support</em>(
32+
<em>'custom-header'</em>,
33+
array( 'width' => 200 )
34+
);
3235
]]>
3336
</code>
34-
<code title="Invalid: The STYLESHEETPATH constant is used in the code.">
37+
<code title="Invalid: (Re-)declaring a WP constant.">
3538
<![CDATA[
36-
$dir = <em>STYLESHEETPATH</em>;
39+
define(
40+
<em>'HEADER_IMAGE_WIDTH'</em>,
41+
200
42+
);
3743
]]>
3844
</code>
3945
</code_comparison>

0 commit comments

Comments
 (0)