3 * Deprecated pluggable functions from past WordPress versions. You shouldn't use these
4 * functions and look for the alternatives instead. The functions will be removed in a
7 * Deprecated warnings are also thrown if one of these functions is being defined by a plugin.
10 * @subpackage Deprecated
15 * Deprecated functions come here to die.
18 if ( !function_exists('set_current_user') ) :
20 * Changes the current user by ID or name.
22 * Set $id to null and specify a name if you do not know a user's ID.
25 * @deprecated 3.0.0 Use wp_set_current_user()
26 * @see wp_set_current_user()
28 * @param int|null $id User ID.
29 * @param string $name Optional. The user's username
30 * @return WP_User returns wp_set_current_user()
32 function set_current_user($id, $name = '') {
33 _deprecated_function( __FUNCTION__, '3.0', 'wp_set_current_user()' );
34 return wp_set_current_user($id, $name);
38 if ( !function_exists('get_userdatabylogin') ) :
40 * Retrieve user info by login name.
43 * @deprecated 3.3.0 Use get_user_by()
46 * @param string $user_login User's username
47 * @return bool|object False on failure, User DB row object
49 function get_userdatabylogin($user_login) {
50 _deprecated_function( __FUNCTION__, '3.3', "get_user_by('login')" );
51 return get_user_by('login', $user_login);
55 if ( !function_exists('get_user_by_email') ) :
57 * Retrieve user info by email.
60 * @deprecated 3.3.0 Use get_user_by()
63 * @param string $email User's email address
64 * @return bool|object False on failure, User DB row object
66 function get_user_by_email($email) {
67 _deprecated_function( __FUNCTION__, '3.3', "get_user_by('email')" );
68 return get_user_by('email', $email);
72 if ( !function_exists('wp_setcookie') ) :
74 * Sets a cookie for a user who just logged in. This function is deprecated.
77 * @deprecated 2.5.0 Use wp_set_auth_cookie()
78 * @see wp_set_auth_cookie()
80 * @param string $username The user's username
81 * @param string $password Optional. The user's password
82 * @param bool $already_md5 Optional. Whether the password has already been through MD5
83 * @param string $home Optional. Will be used instead of COOKIEPATH if set
84 * @param string $siteurl Optional. Will be used instead of SITECOOKIEPATH if set
85 * @param bool $remember Optional. Remember that the user is logged in
87 function wp_setcookie($username, $password = '', $already_md5 = false, $home = '', $siteurl = '', $remember = false) {
88 _deprecated_function( __FUNCTION__, '2.5', 'wp_set_auth_cookie()' );
89 $user = get_user_by('login', $username);
90 wp_set_auth_cookie($user->ID, $remember);
93 _deprecated_function( 'wp_setcookie', '2.5', 'wp_set_auth_cookie()' );
96 if ( !function_exists('wp_clearcookie') ) :
98 * Clears the authentication cookie, logging the user out. This function is deprecated.
101 * @deprecated 2.5.0 Use wp_clear_auth_cookie()
102 * @see wp_clear_auth_cookie()
104 function wp_clearcookie() {
105 _deprecated_function( __FUNCTION__, '2.5', 'wp_clear_auth_cookie()' );
106 wp_clear_auth_cookie();
109 _deprecated_function( 'wp_clearcookie', '2.5', 'wp_clear_auth_cookie()' );
112 if ( !function_exists('wp_get_cookie_login') ):
114 * Gets the user cookie login. This function is deprecated.
116 * This function is deprecated and should no longer be extended as it won't be
117 * used anywhere in WordPress. Also, plugins shouldn't use it either.
122 * @return bool Always returns false
124 function wp_get_cookie_login() {
125 _deprecated_function( __FUNCTION__, '2.5' );
129 _deprecated_function( 'wp_get_cookie_login', '2.5' );
132 if ( !function_exists('wp_login') ) :
134 * Checks a users login information and logs them in if it checks out. This function is deprecated.
136 * Use the global $error to get the reason why the login failed. If the username
137 * is blank, no error will be set, so assume blank username on that case.
139 * Plugins extending this function should also provide the global $error and set
140 * what the error is, so that those checking the global for why there was a
141 * failure can utilize it later.
144 * @deprecated 2.5.0 Use wp_signon()
147 * @global string $error Error when false is returned
149 * @param string $username User's username
150 * @param string $password User's password
151 * @param string $deprecated Not used
152 * @return bool False on login failure, true on successful check
154 function wp_login($username, $password, $deprecated = '') {
155 _deprecated_function( __FUNCTION__, '2.5', 'wp_signon()' );
158 $user = wp_authenticate($username, $password);
160 if ( ! is_wp_error($user) )
163 $error = $user->get_error_message();
167 _deprecated_function( 'wp_login', '2.5', 'wp_signon()' );
171 * WordPress AtomPub API implementation.
173 * Originally stored in wp-app.php, and later wp-includes/class-wp-atom-server.php.
174 * It is kept here in case a plugin directly referred to the class.
179 * @link https://wordpress.org/plugins/atom-publishing-protocol/
181 if ( ! class_exists( 'wp_atom_server', false ) ) {
182 class wp_atom_server {
183 public function __call( $name, $arguments ) {
184 _deprecated_function( __CLASS__ . '::' . $name, '3.5', 'the Atom Publishing Protocol plugin' );
187 public static function __callStatic( $name, $arguments ) {
188 _deprecated_function( __CLASS__ . '::' . $name, '3.5', 'the Atom Publishing Protocol plugin' );