$innerHTML = esc_attr($post->post_title);
return apply_filters('attachment_innerHTML', $innerHTML, $post->ID);
* Retrieves bookmark data based on ID.
* @deprecated 2.1.0 Use get_bookmark()
* @param int $bookmark_id ID of link
* @param string $output Optional. Type of output. Accepts OBJECT, ARRAY_N, or ARRAY_A.
* @param string $filter Optional. How to filter the link for output. Accepts 'raw', 'edit',
* 'attribute', 'js', 'db', or 'display'. Default 'raw'.
* @return object|array Bookmark object or array, depending on the type specified by `$output`.
function get_link( $bookmark_id, $output = OBJECT, $filter = 'raw' ) {
_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmark()' );
return get_bookmark($bookmark_id, $output, $filter);
* Performs esc_url() for database or redirect usage.
* @deprecated 2.8.0 Use esc_url_raw()
* @param string $url The URL to be cleaned.
* @param array $protocols An array of acceptable protocols.
* @return string The cleaned URL.
function sanitize_url( $url, $protocols = null ) {
_deprecated_function( __FUNCTION__, '2.8.0', 'esc_url_raw()' );
return esc_url_raw( $url, $protocols );
* Checks and cleans a URL.
* A number of characters are removed from the URL. If the URL is for displaying
* (the default behaviour) ampersands are also replaced. The 'clean_url' filter
* is applied to the returned cleaned URL.
* @deprecated 3.0.0 Use esc_url()
* @param string $url The URL to be cleaned.
* @param array $protocols Optional. An array of acceptable protocols.
* @param string $context Optional. How the URL will be used. Default is 'display'.
* @return string The cleaned $url after the {@see 'clean_url'} filter is applied.
function clean_url( $url, $protocols = null, $context = 'display' ) {
_deprecated_function( 'clean_url( $context = \'db\' )', '3.0.0', 'esc_url_raw()' );
_deprecated_function( __FUNCTION__, '3.0.0', 'esc_url()' );
return esc_url( $url, $protocols, $context );
* Escape single quotes, specialchar double quotes, and fix line endings.
* The filter {@see 'js_escape'} is also applied by esc_js().
* @deprecated 2.8.0 Use esc_js()
* @param string $text The text to be escaped.
* @return string Escaped text.
function js_escape( $text ) {
_deprecated_function( __FUNCTION__, '2.8.0', 'esc_js()' );
* Legacy escaping for HTML blocks.
* @deprecated 2.8.0 Use esc_html()
* @param string $string String to escape.
* @param string $quote_style Unused.
* @param false|string $charset Unused.
* @param false $double_encode Whether to double encode. Unused.
* @return string Escaped `$string`.
function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
_deprecated_function( __FUNCTION__, '2.8.0', 'esc_html()' );
if ( func_num_args() > 1 ) { // Maintain back-compat for people passing additional arguments.
return _wp_specialchars( $string, $quote_style, $charset, $double_encode );
return esc_html( $string );
* Escaping for HTML attributes.
* @deprecated 2.8.0 Use esc_attr()
function attribute_escape( $text ) {
_deprecated_function( __FUNCTION__, '2.8.0', 'esc_attr()' );
return esc_attr( $text );
* Register widget for sidebar with backward compatibility.
* Allows $name to be an array that accepts either three elements to grab the
* first element and the third for the name or just uses the first element of
* the array for the name.
* Passes to wp_register_sidebar_widget() after argument list and backward
* compatibility is complete.
* @deprecated 2.8.0 Use wp_register_sidebar_widget()
* @see wp_register_sidebar_widget()
* @param string|int $name Widget ID.
* @param callable $output_callback Run when widget is called.
* @param string $classname Optional. Classname widget option. Default empty.
* @param mixed ...$params Widget parameters.
function register_sidebar_widget($name, $output_callback, $classname = '', ...$params) {
_deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_sidebar_widget()' );
if ( is_array( $name ) ) {
if ( count( $name ) === 3 ) {
$name = sprintf( $name[0], $name[2] );
$id = sanitize_title( $name );
if ( ! empty( $classname ) && is_string( $classname ) ) {
$options['classname'] = $classname;
wp_register_sidebar_widget( $id, $name, $output_callback, $options, ...$params );
* Serves as an alias of wp_unregister_sidebar_widget().
* @deprecated 2.8.0 Use wp_unregister_sidebar_widget()
* @see wp_unregister_sidebar_widget()
* @param int|string $id Widget ID.
function unregister_sidebar_widget($id) {
_deprecated_function( __FUNCTION__, '2.8.0', 'wp_unregister_sidebar_widget()' );
return wp_unregister_sidebar_widget($id);
* Registers widget control callback for customizing options.
* Allows $name to be an array that accepts either three elements to grab the
* first element and the third for the name or just uses the first element of
* the array for the name.
* Passes to wp_register_widget_control() after the argument list has
* @deprecated 2.8.0 Use wp_register_widget_control()
* @see wp_register_widget_control()
* @param int|string $name Sidebar ID.
* @param callable $control_callback Widget control callback to display and process form.
* @param int $width Widget width.
* @param int $height Widget height.
* @param mixed ...$params Widget parameters.
function register_widget_control($name, $control_callback, $width = '', $height = '', ...$params) {
_deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_widget_control()' );
if ( is_array( $name ) ) {
if ( count( $name ) === 3 ) {
$name = sprintf( $name[0], $name[2] );
$id = sanitize_title( $name );
if ( ! empty( $width ) ) {
$options['width'] = $width;
if ( ! empty( $height ) ) {
$options['height'] = $height;
wp_register_widget_control( $id, $name, $control_callback, $options, ...$params );
* Alias of wp_unregister_widget_control().
* @deprecated 2.8.0 Use wp_unregister_widget_control()
* @see wp_unregister_widget_control()
* @param int|string $id Widget ID.
function unregister_widget_control($id) {
_deprecated_function( __FUNCTION__, '2.8.0', 'wp_unregister_widget_control()' );
return wp_unregister_widget_control($id);
* @deprecated 3.0.0 Use delete_user_meta()
* @see delete_user_meta()
* @param int $user_id User ID.
* @param string $meta_key Metadata key.
* @param mixed $meta_value Optional. Metadata value. Default empty.
* @return bool True 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()' );
if ( !is_numeric( $user_id ) )
$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) );
$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 );
* 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.
* @deprecated 3.0.0 Use get_user_meta()
* @param int $user_id User ID
* @param string $meta_key Optional. Metadata key. Default empty.
function get_usermeta( $user_id, $meta_key = '' ) {
_deprecated_function( __FUNCTION__, '3.0.0', 'get_user_meta()' );
$user_id = (int) $user_id;
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);
$metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
$metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d", $user_id) );
$metas = array_map('maybe_unserialize', $metas);
if ( count($metas) == 1 )
* 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
* Will remove the metadata, if the meta value is empty.
* @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()' );
if ( !is_numeric( $user_id ) )
$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) );
do_action( 'update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
$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') );
clean_user_cache( $user_id );
wp_cache_delete( $user_id, 'user_meta' );
do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value );
do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
* Get users for the site.
* For setups that use the multisite feature. Can be used outside of the
* @deprecated 3.1.0 Use 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()' );
$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" );
* Enable/disable automatic general feed link outputting.
* @deprecated 3.0.0 Use add_theme_support()
* @see add_theme_support()
* @param bool $add Optional. Add or remove links. Default true.
function automatic_feed_links( $add = true ) {
_deprecated_function( __FUNCTION__, '3.0.0', "add_theme_support( 'automatic-feed-links' )" );
add_theme_support( 'automatic-feed-links' );
remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+.
* Retrieve user data based on field.
* @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()' );
$user = get_user_by( 'login', $user );
return get_the_author_meta( $field, $user );
* Retrieves the number of posts a user has written.
* @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
* @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.
* @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",