deletion completed and false if user_id is not a number. */ function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) { _deprecated_function( __FUNCTION__, '3.0.0', 'delete_user_meta()' ); global $wpdb; if ( !is_numeric( $user_id ) ) return false; $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); if ( is_array($meta_value) || is_object($meta_value) ) $meta_value = serialize($meta_value); $meta_value = trim( $meta_value ); $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); if ( $cur && $cur->umeta_id ) do_action( 'delete_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); if ( ! empty($meta_value) ) $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s", $user_id, $meta_key, $meta_value) ); else $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); clean_user_cache( $user_id ); wp_cache_delete( $user_id, 'user_meta' ); if ( $cur && $cur->umeta_id ) do_action( 'deleted_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); return true; } /** * Retrieve user metadata. * * If $user_id is not a number, then the function will fail over with a 'false' * boolean return value. Other returned values depend on whether there is only * one item to be returned, which be that single item type. If there is more * than one metadata value, then it will be list of metadata values. * * @since 2.0.0 * @deprecated 3.0.0 Use get_user_meta() * @see get_user_meta() * * @param int $user_id User ID * @param string $meta_key Optional. Metadata key. * @return mixed */ function get_usermeta( $user_id, $meta_key = '' ) { _deprecated_function( __FUNCTION__, '3.0.0', 'get_user_meta()' ); global $wpdb; $user_id = (int) $user_id; if ( !$user_id ) return false; if ( !empty($meta_key) ) { $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); $user = wp_cache_get($user_id, 'users'); // Check the cached user object if ( false !== $user && isset($user->$meta_key) ) $metas = array($user->$meta_key); else $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); } else { $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d", $user_id) ); } if ( empty($metas) ) { if ( empty($meta_key) ) return array(); else return ''; } $metas = array_map('maybe_unserialize', $metas); if ( count($metas) == 1 ) return $metas[0]; else return $metas; } /** * Update metadata of user. * * There is no need to serialize values, they will be serialized if it is * needed. The metadata key can only be a string with underscores. All else will * be removed. * * Will remove the metadata, if the meta value is empty. * * @since 2.0.0 * @deprecated 3.0.0 Use update_user_meta() * @see update_user_meta() * * @param int $user_id User ID * @param string $meta_key Metadata key. * @param mixed $meta_value Metadata value. * @return bool True on successful update, false on failure. */ function update_usermeta( $user_id, $meta_key, $meta_value ) { _deprecated_function( __FUNCTION__, '3.0.0', 'update_user_meta()' ); global $wpdb; if ( !is_numeric( $user_id ) ) return false; $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); /** @todo Might need fix because usermeta data is assumed to be already escaped */ if ( is_string($meta_value) ) $meta_value = stripslashes($meta_value); $meta_value = maybe_serialize($meta_value); if (empty($meta_value)) { return delete_usermeta($user_id, $meta_key); } $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); if ( $cur ) do_action( 'update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); if ( !$cur ) $wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') ); elseif ( $cur->meta_value != $meta_value ) $wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') ); else return false; clean_user_cache( $user_id ); wp_cache_delete( $user_id, 'user_meta' ); if ( !$cur ) do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value ); else do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); return true; } /** * Get users for the site. * * For setups that use the multisite feature. Can be used outside of the * multisite feature. * * @since 2.2.0 * @deprecated 3.1.0 Use get_users() * @see get_users() * * @global wpdb $wpdb WordPress database abstraction object. * * @param int $id Site ID. * @return array List of users that are part of that site ID */ function get_users_of_blog( $id = '' ) { _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' ); global $wpdb; if ( empty( $id ) ) { $id = get_current_blog_id(); } $blog_prefix = $wpdb->get_blog_prefix($id); $users = $wpdb->get_results( "SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id" ); return $users; } /** * Enable/disable automatic general feed link outputting. * * @since 2.8.0 * @deprecated 3.0.0 Use add_theme_support() * @see add_theme_support() * * @param bool $add Optional, default is true. Add or remove links. Defaults to true. */ function automatic_feed_links( $add = true ) { _deprecated_function( __FUNCTION__, '3.0.0', "add_theme_support( 'automatic-feed-links' )" ); if ( $add ) add_theme_support( 'automatic-feed-links' ); else remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+ } /** * Retrieve user data based on field. * * @since 1.5.0 * @deprecated 3.0.0 Use get_the_author_meta() * @see get_the_author_meta() * * @param string $field User meta field. * @param false|int $user Optional. User ID to retrieve the field for. Default false (current user). * @return string The author's field from the current author's DB object. */ function get_profile( $field, $user = false ) { _deprecated_function( __FUNCTION__, '3.0.0', 'get_the_author_meta()' ); if ( $user ) { $user = get_user_by( 'login', $user ); $user = $user->ID; } return get_the_author_meta( $field, $user ); } /** * Retrieves the number of posts a user has written. * * @since 0.71 * @deprecated 3.0.0 Use count_user_posts() * @see count_user_posts() * * @param int $userid User to count posts for. * @return int Number of posts the given user has written. */ function get_usernumposts( $userid ) { _deprecated_function( __FUNCTION__, '3.0.0', 'count_user_posts()' ); return count_user_posts( $userid ); } /** * Callback used to change %uXXXX to &#YYY; syntax * * @since 2.8.0 * @access private * @deprecated 3.0.0 * * @param array $matches Single Match * @return string An HTML entity */ function funky_javascript_callback($matches) { return "&#".base_convert($matches[1],16,10).";"; } /** * Fixes JavaScript bugs in browsers. * * Converts unicode characters to HTML numbered entities. * * @since 1.5.0 * @deprecated 3.0.0 * * @global $is_macIE * @global $is_winIE * * @param string $text Text to be made safe. * @return string Fixed text. */ function funky_javascript_fix($text) { _deprecated_function( __FUNCTION__, '3.0.0' ); // Fixes for browsers' JavaScript bugs. global $is_macIE, $is_winIE; if ( $is_winIE || $is_macIE ) $text = preg_replace_callback("/\%u([0-9A-F]{4,4})/", "funky_javascript_callback", $text); return $text; } /** * Checks that the taxonomy name exists. * * @since 2.3.0 * @deprecated 3.0.0 Use taxonomy_exists() * @see taxonomy_exists() * * @param string $taxonomy Name of taxonomy object * @return bool Whether the taxonomy exists. */ function is_taxonomy( $taxonomy ) { _deprecated_function( __FUNCTION__, '3.0.0', 'taxonomy_exists()' ); return taxonomy_exists( $taxonomy ); } /** * Check if Term exists. * * @since 2.3.0 * @deprecated 3.0.0 Use term_exists() * @see term_exists() * * @param int|string $term The term to check * @param string $taxonomy The taxonomy name to use * @param int $parent ID of parent term under which to confine the exists search. * @return mixed Get the term id or Term Object, if exists. */ function is_term( $term, $taxonomy = '', $parent = 0 ) { _deprecated_function( __FUNCTION__, '3.0.0', 'term_exists()' ); return term_exists( $term, $taxonomy, $parent ); } /** * Is the current admin page generated by a plugin? * * Use global $plugin_page and/or get_plugin_page_hookname() hooks. * * @since 1.5.0 * @deprecated 3.1.0 * * @global $plugin_page * * @return bool */ function is_plugin_page() { _deprecated_function( __FUNCTION__, '3.1.0' ); global $plugin_page; if ( isset($plugin_page) ) return true; return false; } /** * Update the categories cache. * * This function does not appear to be used anymore or does not appear to be * needed. It might be a legacy function left over from when there was a need * for updating the category cache. * * @since 1.5.0 * @deprecated 3.1.0 * * @return bool Always return True */ function update_category_cache() { _deprecated_function( __FUNCTION__, '3.1.0' ); return true; } /** * Check for PHP timezone support * * @since 2.9.0 * @deprecated 3.2.0 * * @return bool */ function wp_timezone_supported() { _deprecated_function( __FUNCTION__, '3.2.0' ); return true; } /** * Displays an editor: TinyMCE, HTML, or both. * * @since 2.1.0 * @deprecated 3.3.0 Use wp_editor() * @see wp_editor() * * @param string $content Textarea content. * @param string $id Optional. HTML ID attribute value. Default 'content'. * @param string $prev_id Optional. Unused. * @param bool $media_buttons Optional. Whether to display media buttons. Default true. * @param int $tab_index Optional. Unused. * @param bool $extended Optional. Unused. */ function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2, $extended = true) { _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' ); wp_editor( $content, $id, array( 'media_buttons' => $media_buttons ) ); } /** * Perform the query to get the $metavalues array(s) needed by _fill_user and _fill_many_users * * @since 3.0.0 * @deprecated 3.3.0 * * @param array $ids User ID numbers list. * @return array of arrays. The array is indexed by user_id, containing $metavalues object arrays. */ function get_user_metavalues($ids) { _deprecated_function( __FUNCTION__, '3.3.0' ); $objects = array(); $ids = array_map('intval', $ids); foreach ( $ids as $id ) $objects[$id] = array(); $metas = update_meta_cache('user', $ids); foreach ( $metas as $id => $meta ) { foreach ( $meta as $key => $metavalues ) { foreach ( $metavalues as $value ) { $objects[$id][] = (object)array( 'user_id' => $id, 'meta_key' => $key, 'meta_value' => $value); } } } return $objects; } /** * Sanitize every user field. * * If the context is 'raw', then the user object or array will get minimal santization of the int fields. * * @since 2.3.0 * @deprecated 3.3.0 * * @param object|array $user The User Object or Array * @param string $context Optional, default is 'display'. How to sanitize user fields. * @return object|array The now sanitized User Object or Array (will be the same type as $user) */ function sanitize_user_object($user, $context = 'display') { _deprecated_function( __FUNCTION__, '3.3.0' ); if ( is_object($user) ) { if ( !isset($user->ID) ) $user->ID = 0; if ( ! ( $user instanceof WP_User ) ) { $vars = get_object_vars($user); foreach ( array_keys($vars) as $field ) { if ( is_string($user->$field) || is_numeric($user->$field) ) $user->$field = sanitize_user_field($field, $user->$field, $user->ID, $context); } } $user->filter = $context; } else { if ( !isset($user['ID']) ) $user['ID'] = 0; foreach ( array_keys($user) as $field ) $user[$field] = sanitize_user_field($field, $user[$field], $user['ID'], $context); $user['filter'] = $context; } return $user; } /** * Get boundary post relational link. * * Can either be start or end post relational link. * * @since 2.8.0 * @deprecated 3.3.0 * * @param string $title Optional. Link title format. * @param bool $in_same_cat Optional. Whether link should be in a same category. * @param string $excluded_categories Optional. Excluded categories IDs. * @param bool $start Optional, default is true. Whether to display link to first or last post. * @return string */ function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) { _deprecated_function( __FUNCTION__, '3.3.0' ); $posts = get_boundary_post($in_same_cat, $excluded_categories, $start); // If there is no post stop. if ( empty($posts) ) return; // Even though we limited get_posts to return only 1 item it still returns an array of objects. $post = $posts[0]; if ( empty($post->post_title) ) $post->post_title = $start ? __('First Post') : __('Last Post'); $date = mysql2date(get_option('date_format'), $post->post_date); $title = str_replace('%title', $post->post_title, $title); $title = str_replace('%date', $date, $title); $title = apply_filters('the_title', $title, $post->ID); $link = $start ? "\n"; $boundary = $start ? 'start' : 'end'; return apply_filters( "{$boundary}_post_rel_link", $link ); } /** * Display relational link for the first post. * * @since 2.8.0 * @deprecated 3.3.0 * * @param string $title Optional. Link title format. * @param bool $in_same_cat Optional. Whether link should be in a same category. * @param string $excluded_categories Optional. Excluded categories IDs. */ function start_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') { _deprecated_function( __FUNCTION__, '3.3.0' ); echo get_boundary_post_rel_link($title, $in_same_cat, $excluded_categories, true); } /** * Get site index relational link. * * @since 2.8.0 * @deprecated 3.3.0 * * @return string */ function get_index_rel_link() { _deprecated_function( __FUNCTION__, '3.3.0' ); $link = "\n"; return apply_filters( "index_rel_link", $link ); } /** * Display relational link for the site index. * * @since 2.8.0 * @deprecated 3.3.0 */ function index_rel_link() { _deprecated_function( __FUNCTION__, '3.3.0' ); echo get_index_rel_link(); } /** * Get parent post relational link. * * @since 2.8.0 * @deprecated 3.3.0 * * @param string $title Optional. Link title format. Default '%title'. * @return string */ function get_parent_post_rel_link( $title = '%title' ) { _deprecated_function( __FUNCTION__, '3.3.0' ); if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) ) $post = get_post($GLOBALS['post']->post_parent); if ( empty($post) ) return; $date = mysql2date(get_option('date_format'), $post->post_date); $title = str_replace('%title', $post->post_title, $title); $title = str_replace('%date', $date, $title); $title = apply_filters('the_title', $title, $post->ID); $link = "\n"; return apply_filters( "parent_post_rel_link", $link ); } /** * Display relational link for parent item * * @since 2.8.0 * @deprecated 3.3.0 * * @param string $title Optional. Link title format. Default '%title'. */ function parent_post_rel_link( $title = '%title' ) { _deprecated_function( __FUNCTION__, '3.3.0' ); echo get_parent_post_rel_link($title); } /** * Add the "Dashboard"/"Visit Site" menu. * * @since 3.2.0 * @deprecated 3.3.0 * * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance. */ function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) { _deprecated_function( __FUNCTION__, '3.3.0' ); $user_id = get_current_user_id(); if ( 0 != $user_id ) { if ( is_admin() ) $wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) ); elseif ( is_multisite() ) $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) ); else $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) ); } } /** * Checks if the current user belong to a given site. * * @since MU (3.0.0) * @deprecated 3.3.0 Use is_user_member_of_blog() * @see is_user_member_of_blog() * * @param int $blog_id Site ID * @return bool True if the current users belong to $blog_id, false if not. */ function is_blog_user( $blog_id = 0 ) { _deprecated_function( __FUNCTION__, '3.3.0', 'is_user_member_of_blog()' ); return is_user_member_of_blog( get_current_user_id(), $blog_id ); } /** * Open the file handle for debugging. * * @since 0.71 * @deprecated 3.4.0 Use error_log() * @see error_log() * * @link https://secure.php.net/manual/en/function.error-log.php * * @param string $filename File name. * @param string $mode Type of access you required to the stream. * @return false Always false. */ function debug_fopen( $filename, $mode ) { _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' ); return false; } /** * Write contents to the file used for debugging. * * @since 0.71 * @deprecated 3.4.0 Use error_log() * @see error_log() * * @link https://secure.php.net/manual/en/function.error-log.php * * @param mixed $fp Unused. * @param string $string Message to log. */ function debug_fwrite( $fp, $string ) { _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' ); if ( ! empty( $GLOBALS['debug'] ) ) error_log( $string ); } /** * Close the debugging file handle. * * @since 0.71 * @deprecated 3.4.0 Use error_log() * @see error_log() * * @link https://secure.php.net/manual/en/function.error-log.php * * @param mixed $fp Unused. */ function debug_fclose( $fp ) { _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' ); } /** * Retrieve list of themes with theme data in theme directory. * * The theme is broken, if it doesn't have a parent theme and is missing either * style.css and, or index.php. If the theme has a parent theme then it is * broken, if it is missing style.css; index.php is optional. * * @since 1.5.0 * @deprecated 3.4.0 Use wp_get_themes() * @see wp_get_themes() * * @return array Theme list with theme data. */ function get_themes() { _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_themes()' ); global $wp_themes; if ( isset( $wp_themes ) ) return $wp_themes; $themes = wp_get_themes(); $wp_themes = array(); foreach ( $themes as $theme ) { $name = $theme->get('Name'); if ( isset( $wp_themes[ $name ] ) ) $wp_themes[ $name . '/' . $theme->get_stylesheet() ] = $theme; else $wp_themes[ $name ] = $theme; } return $wp_themes; } /** * Retrieve theme data. * * @since 1.5.0 * @deprecated 3.4.0 Use wp_get_theme() * @see wp_get_theme() * * @param string $theme Theme name. * @return array|null Null, if theme name does not exist. Theme data, if exists. */ function get_theme( $theme ) { _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme( $stylesheet )' ); $themes = get_themes(); if ( is_array( $themes ) && array_key_exists( $theme, $themes ) ) return $themes[ $theme ]; return null; } /** * Retrieve current theme name. * * @since 1.5.0 * @deprecated 3.4.0 Use wp_get_theme() * @see wp_get_theme() * * @return string */ function get_current_theme() { _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' ); if ( $theme = get_option( 'current_theme' ) ) return $theme; return wp_get_theme()->get('Name'); } /** * Accepts matches array from preg_replace_callback in wpautop() or a string. * * Ensures that the contents of a `
...
` HTML block are not * converted into paragraphs or line-breaks. * * @since 1.2.0 * @deprecated 3.4.0 * * @param array|string $matches The array or string * @return string The pre block without paragraph/line-break conversion. */ function clean_pre($matches) { _deprecated_function( __FUNCTION__, '3.4.0' ); if ( is_array($matches) ) $text = $matches[1] . $matches[2] . ""; else $text = $matches; $text = str_replace(array('
', '
', '
'), array('', '', ''), $text); $text = str_replace('

', "\n", $text); $text = str_replace('

', '', $text); return $text; } /** * Add callbacks for image header display. * * @since 2.1.0 * @deprecated 3.4.0 Use add_theme_support() * @see add_theme_support() * * @param callable $wp_head_callback Call on the {@see 'wp_head'} action. * @param callable $admin_head_callback Call on custom header administration screen. * @param callable $admin_preview_callback Output a custom header image div on the custom header administration screen. Optional. */ function add_custom_image_header( $wp_head_callback, $admin_head_callback, $admin_preview_callback = '' ) { _deprecated_function( __FUNCTION__, '3.4.0', 'add_theme_support( \'custom-header\', $args )' ); $args = array( 'wp-head-callback' => $wp_head_callback, 'admin-head-callback' => $admin_head_callback, ); if ( $admin_preview_callback ) $args['admin-preview-callback'] = $admin_preview_callback; return add_theme_support( 'custom-header', $args ); } /** * Remove image header support. * * @since 3.1.0 * @deprecated 3.4.0 Use remove_theme_support() * @see remove_theme_support() * * @return null|bool Whether support was removed. */ function remove_custom_image_header() { _deprecated_function( __FUNCTION__, '3.4.0', 'remove_theme_support( \'custom-header\' )' ); return remove_theme_support( 'custom-header' ); } /** * Add callbacks for background image display. * * @since 3.0.0 * @deprecated 3.4.0 Use add_theme_support() * @see add_theme_support() * * @param callable $wp_head_callback Call on the {@see 'wp_head'} action. * @param callable $admin_head_callback Call on custom background administration screen. * @param callable $admin_preview_callback Output a custom background image div on the custom background administration screen. Optional. */ function add_custom_background( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' ) { _deprecated_function( __FUNCTION__, '3.4.0', 'add_theme_support( \'custom-background\', $args )' ); $args = array(); if ( $wp_head_callback ) $args['wp-head-callback'] = $wp_head_callback; if ( $admin_head_callback ) $args['admin-head-callback'] = $admin_head_callback; if ( $admin_preview_callback ) $args['admin-preview-callback'] = $admin_preview_callback; return add_theme_support( 'custom-background', $args ); } /** * Remove custom background support. * * @since 3.1.0 * @deprecated 3.4.0 Use add_custom_background() * @see add_custom_background() * * @return null|bool Whether support was removed. */ function remove_custom_background() { _deprecated_function( __FUNCTION__, '3.4.0', 'remove_theme_support( \'custom-background\' )' ); return remove_theme_support( 'custom-background' ); } /** * Retrieve theme data from parsed theme file. * * @since 1.5.0 * @deprecated 3.4.0 Use wp_get_theme() * @see wp_get_theme() * * @param string $theme_file Theme file path. * @return array Theme data. */ function get_theme_data( $theme_file ) { _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' ); $theme = new WP_Theme( basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) ); $theme_data = array( 'Name' => $theme->get('Name'), 'URI' => $theme->display('ThemeURI', true, false), 'Description' => $theme->display('Description', true, false), 'Author' => $theme->display('Author', true, false), 'AuthorURI' => $theme->display('AuthorURI', true, false), 'Version' => $theme->get('Version'), 'Template' => $theme->get('Template'), 'Status' => $theme->get('Status'), 'Tags' => $theme->get('Tags'), 'Title' => $theme->get('Name'), 'AuthorName' => $theme->get('Author'), ); foreach ( apply_filters( 'extra_theme_headers', array() ) as $extra_header ) { if ( ! isset( $theme_data[ $extra_header ] ) ) $theme_data[ $extra_header ] = $theme->get( $extra_header ); } return $theme_data; } /** * Alias of update_post_cache(). * * @see update_post_cache() Posts and pages are the same, alias is intentional * * @since 1.5.1 * @deprecated 3.4.0 Use update_post_cache() * @see update_post_cache() * * @param array $pages list of page objects */ function update_page_cache( &$pages ) { _deprecated_function( __FUNCTION__, '3.4.0', 'update_post_cache()' ); update_post_cache( $pages ); } /** * Will clean the page in the cache. * * Clean (read: delete) page from cache that matches $id. Will also clean cache * associated with 'all_page_ids' and 'get_pages'. * * @since 2.0.0 * @deprecated 3.4.0 Use clean_post_cache * @see clean_post_cache() * * @param int $id Page ID to clean */ function clean_page_cache( $id ) { _deprecated_function( __FUNCTION__, '3.4.0', 'clean_post_cache()' ); clean_post_cache( $id ); } /** * Retrieve nonce action "Are you sure" message. * * Deprecated in 3.4.1 and 3.5.0. Backported to 3.3.3. * * @since 2.0.4 * @deprecated 3.4.1 Use wp_nonce_ays() * @see wp_nonce_ays() * * @param string $action Nonce action. * @return string Are you sure message. */ function wp_explain_nonce( $action ) { _deprecated_function( __FUNCTION__, '3.4.1', 'wp_nonce_ays()' ); return __( 'Are you sure you want to do this?' ); } /** * Display "sticky" CSS class, if a post is sticky. * * @since 2.7.0 * @deprecated 3.5.0 Use post_class() * @see post_class() * * @param int $post_id An optional post ID. */ function sticky_class( $post_id = null ) { _deprecated_function( __FUNCTION__, '3.5.0', 'post_class()' ); if ( is_sticky( $post_id ) ) echo ' sticky'; } /** * Retrieve post ancestors. * * This is no longer needed as WP_Post lazy-loads the ancestors * property with get_post_ancestors(). * * @since 2.3.4 * @deprecated 3.5.0 Use get_post_ancestors() * @see get_post_ancestors() * * @param WP_Post $post Post object, passed by reference (unused). */ function _get_post_ancestors( &$post ) { _deprecated_function( __FUNCTION__, '3.5.0' ); } /** * Load an image from a string, if PHP supports it. * * @since 2.1.0 * @deprecated 3.5.0 Use wp_get_image_editor() * @see wp_get_image_editor() * * @param string $file Filename of the image to load. * @return resource The resulting image resource on success, Error string on failure. */ function wp_load_image( $file ) { _deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' ); if ( is_numeric( $file ) ) $file = get_attached_file( $file ); if ( ! is_file( $file ) ) { /* translators: %s: file name */ return sprintf( __( 'File “%s” doesn’t exist?' ), $file ); } if ( ! function_exists('imagecreatefromstring') ) return __('The GD image library is not installed.'); // Set artificially high because GD uses uncompressed images in memory. wp_raise_memory_limit( 'image' ); $image = imagecreatefromstring( file_get_contents( $file ) ); if ( ! is_resource( $image ) ) { /* translators: %s: file name */ return sprintf( __( 'File “%s” is not an image.' ), $file ); } return $image; } /** * Scale down an image to fit a particular size and save a new copy of the image. * * The PNG transparency will be preserved using the function, as well as the * image type. If the file going in is PNG, then the resized image is going to * be PNG. The only supported image types are PNG, GIF, and JPEG. * * Some functionality requires API to exist, so some PHP version may lose out * support. This is not the fault of WordPress (where functionality is * downgraded, not actual defects), but of your PHP version. * * @since 2.5.0 * @deprecated 3.5.0 Use wp_get_image_editor() * @see wp_get_image_editor() * * @param string $file Image file path. * @param int $max_w Maximum width to resize to. * @param int $max_h Maximum height to resize to. * @param bool $crop Optional. Whether to crop image or resize. * @param string $suffix Optional. File suffix. * @param string $dest_path Optional. New image file path. * @param int $jpeg_quality Optional, default is 90. Image quality percentage. * @return mixed WP_Error on failure. String with new destination path. */ function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) { _deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' ); $editor = wp_get_image_editor( $file ); if ( is_wp_error( $editor ) ) return $editor; $editor->set_quality( $jpeg_quality ); $resized = $editor->resize( $max_w, $max_h, $crop ); if ( is_wp_error( $resized ) ) return $resized; $dest_file = $editor->generate_filename( $suffix, $dest_path ); $saved = $editor->save( $dest_file ); if ( is_wp_error( $saved ) ) return $saved; return $dest_file; } /** * Retrieve a single post, based on post ID. * * Has categories in 'post_category' property or key. Has tags in 'tags_input' * property or key. * * @since 1.0.0 * @deprecated 3.5.0 Use get_post() * @see get_post() * * @param int $postid Post ID. * @param string $mode How to return result, either OBJECT, ARRAY_N, or ARRAY_A. * @return WP_Post|null Post object or array holding post contents and information */ function wp_get_single_post( $postid = 0, $mode = OBJECT ) { _deprecated_function( __FUNCTION__, '3.5.0', 'get_post()' ); return get_post( $postid, $mode ); } /** * Check that the user login name and password is correct. * * @since 0.71 * @deprecated 3.5.0 Use wp_authenticate() * @see wp_authenticate() * * @param string $user_login User name. * @param string $user_pass User password. * @return bool False if does not authenticate, true if username and password authenticates. */ function user_pass_ok($user_login, $user_pass) { _deprecated_function( __FUNCTION__, '3.5.0', 'wp_authenticate()' ); $user = wp_authenticate( $user_login, $user_pass ); if ( is_wp_error( $user ) ) return false; return true; } /** * Callback formerly fired on the save_post hook. No longer needed. * * @since 2.3.0 * @deprecated 3.5.0 */ function _save_post_hook() {} /** * Check if the installed version of GD supports particular image type * * @since 2.9.0 * @deprecated 3.5.0 Use wp_image_editor_supports() * @see wp_image_editor_supports() * * @param string $mime_type * @return bool */ function gd_edit_image_support($mime_type) { _deprecated_function( __FUNCTION__, '3.5.0', 'wp_image_editor_supports()' ); if ( function_exists('imagetypes') ) { switch( $mime_type ) { case 'image/jpeg': return (imagetypes() & IMG_JPG) != 0; case 'image/png': return (imagetypes() & IMG_PNG) != 0; case 'image/gif': return (imagetypes() & IMG_GIF) != 0; } } else { switch( $mime_type ) { case 'image/jpeg': return function_exists('imagecreatefromjpeg'); case 'image/png': return function_exists('imagecreatefrompng'); case 'image/gif': return function_exists('imagecreatefromgif'); } } return false; } /** * Converts an integer byte value to a shorthand byte value. * * @since 2.3.0 * @deprecated 3.6.0 Use size_format() * @see size_format() * * @param int $bytes An integer byte value. * @return string A shorthand byte value. */ function wp_convert_bytes_to_hr( $bytes ) { _deprecated_function( __FUNCTION__, '3.6.0', 'size_format()' ); $units = array( 0 => 'B', 1 => 'KB', 2 => 'MB', 3 => 'GB', 4 => 'TB' ); $log = log( $bytes, KB_IN_BYTES ); $power = (int) $log; $size = pow( KB_IN_BYTES, $log - $power ); if ( ! is_nan( $size ) && array_key_exists( $power, $units ) ) { $unit = $units[ $power ]; } else { $size = $bytes; $unit = $units[0]; } return $size . $unit; } /** * Formerly used internally to tidy up the search terms. * * @since 2.9.0 * @access private * @deprecated 3.7.0 * * @param string $t Search terms to "tidy", e.g. trim. * @return string Trimmed search terms. */ function _search_terms_tidy( $t ) { _deprecated_function( __FUNCTION__, '3.7.0' ); return trim( $t, "\"'\n\r " ); } /** * Determine if TinyMCE is available. * * Checks to see if the user has deleted the tinymce files to slim down * their WordPress installation. * * @since 2.1.0 * @deprecated 3.9.0 * * @return bool Whether TinyMCE exists. */ function rich_edit_exists() { global $wp_rich_edit_exists; _deprecated_function( __FUNCTION__, '3.9.0' ); if ( ! isset( $wp_rich_edit_exists ) ) $wp_rich_edit_exists = file_exists( ABSPATH . WPINC . '/js/tinymce/tinymce.js' ); return $wp_rich_edit_exists; } /** * Old callback for tag link tooltips. * * @since 2.7.0 * @access private * @deprecated 3.9.0 * * @param int $count Number of topics. * @return int Number of topics. */ function default_topic_count_text( $count ) { return $count; } /** * Formerly used to escape strings before inserting into the DB. * * Has not performed this function for many, many years. Use wpdb::prepare() instead. * * @since 0.71 * @deprecated 3.9.0 * * @param string $content The text to format. * @return string The very same text. */ function format_to_post( $content ) { _deprecated_function( __FUNCTION__, '3.9.0' ); return $content; } /** * Formerly used to escape strings before searching the DB. It was poorly documented and never worked as described. * * @since 2.5.0 * @deprecated 4.0.0 Use wpdb::esc_like() * @see wpdb::esc_like() * * @param string $text The text to be escaped. * @return string text, safe for inclusion in LIKE query. */ function like_escape($text) { _deprecated_function( __FUNCTION__, '4.0.0', 'wpdb::esc_like()' ); return str_replace( array( "%", "_" ), array( "\\%", "\\_" ), $text ); } /** * Determines if the URL can be accessed over SSL. * * Determines if the URL can be accessed over SSL by using the WordPress HTTP API to access * the URL using https as the scheme. * * @since 2.5.0 * @deprecated 4.0.0 * * @param string $url The URL to test. * @return bool Whether SSL access is available. */ function url_is_accessable_via_ssl( $url ) { _deprecated_function( __FUNCTION__, '4.0.0' ); $response = wp_remote_get( set_url_scheme( $url, 'https' ) ); if ( !is_wp_error( $response ) ) { $status = wp_remote_retrieve_response_code( $response ); if ( 200 == $status || 401 == $status ) { return true; } } return false; } /** * Start preview theme output buffer. * * Will only perform task if the user has permissions and template and preview * query variables exist. * * @since 2.6.0 * @deprecated 4.3.0 */ function preview_theme() { _deprecated_function( __FUNCTION__, '4.3.0' ); } /** * Private function to modify the current template when previewing a theme * * @since 2.9.0 * @deprecated 4.3.0 * @access private * * @return string */ function _preview_theme_template_filter() { _deprecated_function( __FUNCTION__, '4.3.0' ); return ''; } /** * Private function to modify the current stylesheet when previewing a theme * * @since 2.9.0 * @deprecated 4.3.0 * @access private * * @return string */ function _preview_theme_stylesheet_filter() { _deprecated_function( __FUNCTION__, '4.3.0' ); return ''; } /** * Callback function for ob_start() to capture all links in the theme. * * @since 2.6.0 * @deprecated 4.3.0 * @access private * * @param string $content * @return string */ function preview_theme_ob_filter( $content ) { _deprecated_function( __FUNCTION__, '4.3.0' ); return $content; } /** * Manipulates preview theme links in order to control and maintain location. * * Callback function for preg_replace_callback() to accept and filter matches. * * @since 2.6.0 * @deprecated 4.3.0 * @access private * * @param array $matches * @return string */ function preview_theme_ob_filter_callback( $matches ) { _deprecated_function( __FUNCTION__, '4.3.0' ); return ''; } /** * Formats text for the rich text editor. * * The {@see 'richedit_pre'} filter is applied here. If $text is empty the filter will * be applied to an empty string. * * @since 2.0.0 * @deprecated 4.3.0 Use format_for_editor() * @see format_for_editor() * * @param string $text The text to be formatted. * @return string The formatted text after filter is applied. */ function wp_richedit_pre($text) { _deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' ); if ( empty( $text ) ) { /** * Filters text returned for the rich text editor. * * This filter is first evaluated, and the value returned, if an empty string * is passed to wp_richedit_pre(). If an empty string is passed, it results * in a break tag and line feed. * * If a non-empty string is passed, the filter is evaluated on the wp_richedit_pre() * return after being formatted. * * @since 2.0.0 * @deprecated 4.3.0 * * @param string $output Text for the rich text editor. */ return apply_filters( 'richedit_pre', '' ); } $output = convert_chars($text); $output = wpautop($output); $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); /** This filter is documented in wp-includes/deprecated.php */ return apply_filters( 'richedit_pre', $output ); } /** * Formats text for the HTML editor. * * Unless $output is empty it will pass through htmlspecialchars before the * {@see 'htmledit_pre'} filter is applied. * * @since 2.5.0 * @deprecated 4.3.0 Use format_for_editor() * @see format_for_editor() * * @param string $output The text to be formatted. * @return string Formatted text after filter applied. */ function wp_htmledit_pre($output) { _deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' ); if ( !empty($output) ) $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); // convert only < > & /** * Filters the text before it is formatted for the HTML editor. * * @since 2.5.0 * @deprecated 4.3.0 * * @param string $output The HTML-formatted text. */ return apply_filters( 'htmledit_pre', $output ); } /** * Retrieve permalink from post ID. * * @since 1.0.0 * @deprecated 4.4.0 Use get_permalink() * @see get_permalink() * * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post. * @return string|false */ function post_permalink( $post_id = 0 ) { _deprecated_function( __FUNCTION__, '4.4.0', 'get_permalink()' ); return get_permalink( $post_id ); } /** * Perform a HTTP HEAD or GET request. * * If $file_path is a writable filename, this will do a GET request and write * the file to that path. * * @since 2.5.0 * @deprecated 4.4.0 Use WP_Http * @see WP_Http * * @param string $url URL to fetch. * @param string|bool $file_path Optional. File path to write request to. Default false. * @param int $red Optional. The number of Redirects followed, Upon 5 being hit, * returns false. Default 1. * @return bool|string False on failure and string of headers if HEAD request. */ function wp_get_http( $url, $file_path = false, $red = 1 ) { _deprecated_function( __FUNCTION__, '4.4.0', 'WP_Http' ); @set_time_limit( 60 ); if ( $red > 5 ) return false; $options = array(); $options['redirection'] = 5; if ( false == $file_path ) $options['method'] = 'HEAD'; else $options['method'] = 'GET'; $response = wp_safe_remote_request( $url, $options ); if ( is_wp_error( $response ) ) return false; $headers = wp_remote_retrieve_headers( $response ); $headers['response'] = wp_remote_retrieve_response_code( $response ); // WP_HTTP no longer follows redirects for HEAD requests. if ( 'HEAD' == $options['method'] && in_array($headers['response'], array(301, 302)) && isset( $headers['location'] ) ) { return wp_get_http( $headers['location'], $file_path, ++$red ); } if ( false == $file_path ) return $headers; // GET request - write it to the supplied filename $out_fp = fopen($file_path, 'w'); if ( !$out_fp ) return $headers; fwrite( $out_fp, wp_remote_retrieve_body( $response ) ); fclose($out_fp); clearstatcache(); return $headers; } /** * Whether SSL login should be forced. * * @since 2.6.0 * @deprecated 4.4.0 Use force_ssl_admin() * @see force_ssl_admin() * * @param string|bool $force Optional Whether to force SSL login. Default null. * @return bool True if forced, false if not forced. */ function force_ssl_login( $force = null ) { _deprecated_function( __FUNCTION__, '4.4.0', 'force_ssl_admin()' ); return force_ssl_admin( $force ); } /** * Retrieve path of comment popup template in current or parent template. * * @since 1.5.0 * @deprecated 4.5.0 * * @return string Full path to comments popup template file. */ function get_comments_popup_template() { _deprecated_function( __FUNCTION__, '4.5.0' ); return ''; } /** * Whether the current URL is within the comments popup window. * * @since 1.5.0 * @deprecated 4.5.0 * * @return bool */ function is_comments_popup() { _deprecated_function( __FUNCTION__, '4.5.0' ); return false; } /** * Display the JS popup script to show a comment. * * @since 0.71 * @deprecated 4.5.0 */ function comments_popup_script() { _deprecated_function( __FUNCTION__, '4.5.0' ); } /** * Adds element attributes to open links in new windows. * * @since 0.71 * @deprecated 4.5.0 * * @param string $text Content to replace links to open in a new window. * @return string Content that has filtered links. */ function popuplinks( $text ) { _deprecated_function( __FUNCTION__, '4.5.0' ); $text = preg_replace('//i', "", $text); return $text; } /** * The Google Video embed handler callback. * * Deprecated function that previously assisted in turning Google Video URLs * into embeds but that service has since been shut down. * * @since 2.9.0 * @deprecated 4.6.0 * * @return string An empty string. */ function wp_embed_handler_googlevideo( $matches, $attr, $url, $rawattr ) { _deprecated_function( __FUNCTION__, '4.6.0' ); return ''; } /** * Retrieve path of paged template in current or parent template. * * @since 1.5.0 * @deprecated 4.7.0 The paged.php template is no longer part of the theme template hierarchy. * * @return string Full path to paged template file. */ function get_paged_template() { _deprecated_function( __FUNCTION__, '4.7.0' ); return get_query_template( 'paged' ); } /** * Removes the HTML JavaScript entities found in early versions of Netscape 4. * * Previously, this function was pulled in from the original * import of kses and removed a specific vulnerability only * existent in early version of Netscape 4. However, this * vulnerability never affected any other browsers and can * be considered safe for the modern web. * * The regular expression which sanitized this vulnerability * has been removed in consideration of the performance and * energy demands it placed, now merely passing through its * input to the return. * * @since 1.0.0 * @deprecated 4.7.0 Officially dropped security support for Netscape 4. * * @param string $string * @return string */ function wp_kses_js_entities( $string ) { _deprecated_function( __FUNCTION__, '4.7.0' ); return preg_replace( '%&\s*\{[^}]*(\}\s*;?|$)%', '', $string ); } /** * Sort categories by ID. * * Used by usort() as a callback, should not be used directly. Can actually be * used to sort any term object. * * @since 2.3.0 * @deprecated 4.7.0 Use wp_list_sort() * @access private * * @param object $a * @param object $b * @return int */ function _usort_terms_by_ID( $a, $b ) { _deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort()' ); if ( $a->term_id > $b->term_id ) return 1; elseif ( $a->term_id < $b->term_id ) return -1; else return 0; } /** * Sort categories by name. * * Used by usort() as a callback, should not be used directly. Can actually be * used to sort any term object. * * @since 2.3.0 * @deprecated 4.7.0 Use wp_list_sort() * @access private * * @param object $a * @param object $b * @return int */ function _usort_terms_by_name( $a, $b ) { _deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort()' ); return strcmp( $a->name, $b->name ); } /** * Sort menu items by the desired key. * * @since 3.0.0 * @deprecated 4.7.0 Use wp_list_sort() * @access private * * @global string $_menu_item_sort_prop * * @param object $a The first object to compare * @param object $b The second object to compare * @return int -1, 0, or 1 if $a is considered to be respectively less than, equal to, or greater than $b. */ function _sort_nav_menu_items( $a, $b ) { global $_menu_item_sort_prop; _deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort()' ); if ( empty( $_menu_item_sort_prop ) ) return 0; if ( ! isset( $a->$_menu_item_sort_prop ) || ! isset( $b->$_menu_item_sort_prop ) ) return 0; $_a = (int) $a->$_menu_item_sort_prop; $_b = (int) $b->$_menu_item_sort_prop; if ( $a->$_menu_item_sort_prop == $b->$_menu_item_sort_prop ) return 0; elseif ( $_a == $a->$_menu_item_sort_prop && $_b == $b->$_menu_item_sort_prop ) return $_a < $_b ? -1 : 1; else return strcmp( $a->$_menu_item_sort_prop, $b->$_menu_item_sort_prop ); } /** * Retrieves the Press This bookmarklet link. * * @since 2.6.0 * @deprecated 4.9.0 * */ function get_shortcut_link() { _deprecated_function( __FUNCTION__, '4.9.0' ); $link = ''; /** * Filters the Press This bookmarklet link. * * @since 2.6.0 * @deprecated 4.9.0 * * @param string $link The Press This bookmarklet link. */ return apply_filters( 'shortcut_link', $link ); } /** * Ajax handler for saving a post from Press This. * * @since 4.2.0 * @deprecated 4.9.0 */ function wp_ajax_press_this_save_post() { _deprecated_function( __FUNCTION__, '4.9.0' ); if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) { include( WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php' ); $wp_press_this = new WP_Press_This_Plugin(); $wp_press_this->save_post(); } else { wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) ); } } /** * Ajax handler for creating new category from Press This. * * @since 4.2.0 * @deprecated 4.9.0 */ function wp_ajax_press_this_add_category() { _deprecated_function( __FUNCTION__, '4.9.0' ); if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) { include( WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php' ); $wp_press_this = new WP_Press_This_Plugin(); $wp_press_this->add_category(); } else { wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) ); } } /** * Filter the SQL clauses of an attachment query to include filenames. * * @since 4.7.0 * @deprecated 6.0.3 * @access private * * @param array $clauses An array including WHERE, GROUP BY, JOIN, ORDER BY, * DISTINCT, fields (SELECT), and LIMITS clauses. * @return array The unmodified clauses. */ function _filter_query_attachment_filenames( $clauses ) { _deprecated_function( __FUNCTION__, '6.0.3', 'add_filter( "wp_allow_query_attachment_by_filename", "__return_true" )'); remove_filter( 'posts_clauses', __FUNCTION__ ); return $clauses; }