* Deprecated functions from past WordPress versions. You shouldn't use these
* functions and look for the alternatives instead. The functions will be
* removed in a later version.
* Deprecated functions come here to die.
* Retrieves all post data for a given post.
* @deprecated 1.5.1 Use get_post()
* @param int $postid Post ID.
* @return array Post data.
function get_postdata($postid) {
_deprecated_function( __FUNCTION__, '1.5.1', 'get_post()' );
$post = get_post($postid);
'Author_ID' => $post->post_author,
'Date' => $post->post_date,
'Content' => $post->post_content,
'Excerpt' => $post->post_excerpt,
'Title' => $post->post_title,
'Category' => $post->post_category,
'post_status' => $post->post_status,
'comment_status' => $post->comment_status,
'ping_status' => $post->ping_status,
'post_password' => $post->post_password,
'to_ping' => $post->to_ping,
'pinged' => $post->pinged,
'post_type' => $post->post_type,
'post_name' => $post->post_name
* Sets up the WordPress Loop.
* @link https://developer.wordpress.org/themes/basics/the-loop/
_deprecated_function( __FUNCTION__, '1.5.0', __('new WordPress Loop') );
// Since the old style loop is being used, advance the query iterator here.
setup_postdata( get_post() );
* Returns or prints a category ID.
* @deprecated 0.71 Use get_the_category()
* @see get_the_category()
* @param bool $echo Optional. Whether to echo the output. Default true.
* @return int Category ID.
function the_category_ID($echo = true) {
_deprecated_function( __FUNCTION__, '0.71', 'get_the_category()' );
// Grab the first cat in the list.
$categories = get_the_category();
$cat = $categories[0]->term_id;
* Prints a category with optional text before and after.
* @deprecated 0.71 Use get_the_category_by_ID()
* @see get_the_category_by_ID()
* @param string $before Optional. Text to display before the category. Default empty.
* @param string $after Optional. Text to display after the category. Default empty.
function the_category_head( $before = '', $after = '' ) {
global $currentcat, $previouscat;
_deprecated_function( __FUNCTION__, '0.71', 'get_the_category_by_ID()' );
// Grab the first cat in the list.
$categories = get_the_category();
$currentcat = $categories[0]->category_id;
if ( $currentcat != $previouscat ) {
echo get_the_category_by_ID($currentcat);
$previouscat = $currentcat;
* Prints a link to the previous post.
* @deprecated 2.0.0 Use previous_post_link()
* @see previous_post_link()
* @param string $previous
* @param string $in_same_cat
* @param string $excluded_categories
function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') {
_deprecated_function( __FUNCTION__, '2.0.0', 'previous_post_link()' );
if ( empty($in_same_cat) || 'no' == $in_same_cat )
$post = get_previous_post($in_same_cat, $excluded_categories);
$string = '<a href="'.get_permalink($post->ID).'">'.$previous;
$string .= apply_filters('the_title', $post->post_title, $post->ID);
$format = str_replace('%', $string, $format);
* Prints link to the next post.
* @deprecated 2.0.0 Use next_post_link()
* @param string $in_same_cat
* @param string $excluded_categories
function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') {
_deprecated_function( __FUNCTION__, '2.0.0', 'next_post_link()' );
if ( empty($in_same_cat) || 'no' == $in_same_cat )
$post = get_next_post($in_same_cat, $excluded_categories);
$string = '<a href="'.get_permalink($post->ID).'">'.$next;
$string .= apply_filters('the_title', $post->post_title, $post->ID);
$format = str_replace('%', $string, $format);
* Whether user can create a post.
* @deprecated 2.0.0 Use current_user_can()
* @see current_user_can()
* @param int $blog_id Not Used
* @param int $category_id Not Used
function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') {
_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
$author_data = get_userdata($user_id);
return ($author_data->user_level > 1);
* Whether user can create a post.
* @deprecated 2.0.0 Use current_user_can()
* @see current_user_can()
* @param int $blog_id Not Used
* @param int $category_id Not Used
function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') {
_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
$author_data = get_userdata($user_id);
return ($author_data->user_level >= 1);
* Whether user can edit a post.
* @deprecated 2.0.0 Use current_user_can()
* @see current_user_can()
* @param int $blog_id Not Used
function user_can_edit_post($user_id, $post_id, $blog_id = 1) {
_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
$author_data = get_userdata($user_id);
$post = get_post($post_id);
$post_author_data = get_userdata($post->post_author);
if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2))
|| ($author_data->user_level > $post_author_data->user_level)
|| ($author_data->user_level >= 10) ) {
* Whether user can delete a post.
* @deprecated 2.0.0 Use current_user_can()
* @see current_user_can()
* @param int $blog_id Not Used
function user_can_delete_post($user_id, $post_id, $blog_id = 1) {
_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
// Right now if one can edit, one can delete.
return user_can_edit_post($user_id, $post_id, $blog_id);
* Whether user can set new posts' dates.
* @deprecated 2.0.0 Use current_user_can()
* @see current_user_can()
* @param int $blog_id Not Used
* @param int $category_id Not Used
function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') {
_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
$author_data = get_userdata($user_id);
return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id));
* Whether user can delete a post.
* @deprecated 2.0.0 Use current_user_can()
* @see current_user_can()
* @param int $blog_id Not Used
* @return bool returns true if $user_id can edit $post_id's date
function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) {
_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
$author_data = get_userdata($user_id);
return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id));
* Whether user can delete a post.
* @deprecated 2.0.0 Use current_user_can()
* @see current_user_can()
* @param int $blog_id Not Used
* @return bool returns true if $user_id can edit $post_id's comments
function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) {
_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
// Right now if one can edit a post, one can edit comments made on it.
return user_can_edit_post($user_id, $post_id, $blog_id);
* Whether user can delete a post.
* @deprecated 2.0.0 Use current_user_can()
* @see current_user_can()
* @param int $blog_id Not Used
* @return bool returns true if $user_id can delete $post_id's comments
function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) {
_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
// Right now if one can edit comments, one can delete comments.
return user_can_edit_post_comments($user_id, $post_id, $blog_id);
* Can user can edit other user.
* @deprecated 2.0.0 Use current_user_can()
* @see current_user_can()
function user_can_edit_user($user_id, $other_user) {
_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
$user = get_userdata($user_id);
$other = get_userdata($other_user);
if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID )
* Gets the links associated with category $cat_name.
* @deprecated 2.1.0 Use get_bookmarks()
* @param string $cat_name Optional. The category name to use. If no match is found, uses all.
* @param string $before Optional. The HTML to output before the link. Default empty.
* @param string $after Optional. The HTML to output after the link. Default '<br />'.
* @param string $between Optional. The HTML to output between the link/image and its description.
* Not used if no image or $show_images is true. Default ' '.
* @param bool $show_images Optional. Whether to show images (if defined). Default true.
* @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url',
* 'description', 'rating', or 'owner'. Default 'id'.
* If you start the name with an underscore, the order will be reversed.
* Specifying 'rand' as the order will return links in a random order.
* @param bool $show_description Optional. Whether to show the description if show_images=false/not defined.
* @param bool $show_rating Optional. Show rating stars/chars. Default false.
* @param int $limit Optional. Limit to X entries. If not specified, all entries are shown.
* @param int $show_updated Optional. Whether to show last updated timestamp. Default 0.
function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = true, $orderby = 'id',
$show_description = true, $show_rating = false,
$limit = -1, $show_updated = 0) {
_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
$cat = get_term_by('name', $cat_name, 'link_category');
get_links($cat_id, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated);
* Gets the links associated with the named category.
* @deprecated 2.1.0 Use wp_list_bookmarks()
* @see wp_list_bookmarks()
* @param string $category The category to use.
function wp_get_linksbyname($category, $args = '') {
_deprecated_function(__FUNCTION__, '2.1.0', 'wp_list_bookmarks()');
'category_name' => $category,
$parsed_args = wp_parse_args( $args, $defaults );
return wp_list_bookmarks($parsed_args);
* Gets an array of link objects associated with category $cat_name.
* $links = get_linkobjectsbyname( 'fred' );
* foreach ( $links as $link ) {
* echo '<li>' . $link->link_name . '</li>';
* @deprecated 2.1.0 Use get_bookmarks()
* @param string $cat_name Optional. The category name to use. If no match is found, uses all.
* @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url',
* 'description', 'rating', or 'owner'. Default 'name'.
* If you start the name with an underscore, the order will be reversed.
* Specifying 'rand' as the order will return links in a random order.
* @param int $limit Optional. Limit to X entries. If not specified, all entries are shown.
function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) {
_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
$cat = get_term_by('name', $cat_name, 'link_category');
return get_linkobjects($cat_id, $orderby, $limit);
* Gets an array of link objects associated with category n.
* $links = get_linkobjects(1);
* foreach ($links as $link) {
* echo '<li>'.$link->link_name.'<br />'.$link->link_description.'</li>';