-
-
Notifications
You must be signed in to change notification settings - Fork 488
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New error handling Deprecated Classes and Functions (#1729)
New error handling Deprecated Classes and Functions Co-authored-by: Juliette <[email protected]>
- Loading branch information
Showing
4 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<documentation title="Deprecated Classes"> | ||
<standard> | ||
<![CDATA[ | ||
Please refrain from using deprecated WordPress classes. | ||
]]> | ||
</standard> | ||
<code_comparison> | ||
<code title="Valid: use of a current (non-deprecated) class."> | ||
<![CDATA[ | ||
$a = new <em>WP_User_Query</em>(); | ||
]]> | ||
</code> | ||
<code title="Invalid: use of a deprecated class."> | ||
<![CDATA[ | ||
$a = new <em>WP_User_Search</em>(); // Deprecated WP 3.1. | ||
]]> | ||
</code> | ||
</code_comparison> | ||
</documentation> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<documentation title="Deprecated Functions"> | ||
<standard> | ||
<![CDATA[ | ||
Please refrain from using deprecated WordPress functions. | ||
]]> | ||
</standard> | ||
<code_comparison> | ||
<code title="Valid: use of a current (non-deprecated) function."> | ||
<![CDATA[ | ||
$sites = <em>get_sites</em>(); | ||
]]> | ||
</code> | ||
<code title="Invalid: use of a deprecated function."> | ||
<![CDATA[ | ||
$sites = <em>wp_get_sites</em>(); // Deprecated WP 4.6. | ||
]]> | ||
</code> | ||
</code_comparison> | ||
</documentation> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<documentation title="Deprecated Function Parameter Values"> | ||
<standard> | ||
<![CDATA[ | ||
Please refrain from using deprecated WordPress function parameter values. | ||
]]> | ||
</standard> | ||
<code_comparison> | ||
<code title="Valid: passing a valid function parameter value."> | ||
<![CDATA[ | ||
bloginfo( <em>'url'</em> ); | ||
]]> | ||
</code> | ||
<code title="Invalid: passing a deprecated function parameter value."> | ||
<![CDATA[ | ||
bloginfo ( <em>'home'</em> ); // Deprecated WP 2.2.0. | ||
]]> | ||
</code> | ||
</code_comparison> | ||
</documentation> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<documentation title="Deprecated Function Parameters"> | ||
<standard> | ||
<![CDATA[ | ||
Please refrain from passing deprecated WordPress function parameters. | ||
In case, you need to pass an optional parameter positioned <em>after</em> the deprecated parameter, only ever pass the default value. | ||
]]> | ||
</standard> | ||
<code_comparison> | ||
<code title="Valid: not passing a deprecated parameter."> | ||
<![CDATA[ | ||
// First - and only - parameter deprecated. | ||
get_the_author(); | ||
]]> | ||
</code> | ||
<code title="Invalid: passing a deprecated parameter."> | ||
<![CDATA[ | ||
// First - and only - parameter deprecated. | ||
get_the_author( <em>$string</em> ); | ||
]]> | ||
</code> | ||
</code_comparison> | ||
<code_comparison> | ||
<code title="Valid: passing default value for a deprecated parameter."> | ||
<![CDATA[ | ||
// Third parameter deprecated in WP 2.3.0. | ||
add_option( 'option_name', 123, <em>''</em>, 'yes' ); | ||
]]> | ||
</code> | ||
<code title="Invalid: not passing the default value for a deprecated parameter."> | ||
<![CDATA[ | ||
// Third parameter deprecated in WP 2.3.0. | ||
add_option( 'my_name', 123, <em>'oops'</em>, 'yes' ); | ||
]]> | ||
</code> | ||
</code_comparison> | ||
</documentation> |