3 * Deprecated functions from past WordPress versions. You shouldn't use these
4 * functions and look for the alternatives instead. The functions will be
5 * removed in a later version.
8 * @subpackage Deprecated
12 * Deprecated functions come here to die.
20 * @deprecated Use get_post()
26 function get_postdata($postid) {
27 _deprecated_function( __FUNCTION__, '1.5.1', 'get_post()' );
29 $post = &get_post($postid);
33 'Author_ID' => $post->post_author,
34 'Date' => $post->post_date,
35 'Content' => $post->post_content,
36 'Excerpt' => $post->post_excerpt,
37 'Title' => $post->post_title,
38 'Category' => $post->post_category,
39 'post_status' => $post->post_status,
40 'comment_status' => $post->comment_status,
41 'ping_status' => $post->ping_status,
42 'post_password' => $post->post_password,
43 'to_ping' => $post->to_ping,
44 'pinged' => $post->pinged,
45 'post_type' => $post->post_type,
46 'post_name' => $post->post_name
53 * Sets up the WordPress Loop.
57 * @deprecated Use The Loop - {@link http://codex.wordpress.org/The_Loop Use new WordPress Loop}
60 global $wp_query, $post;
62 _deprecated_function( __FUNCTION__, '1.5', __('new WordPress Loop') );
64 // Since the old style loop is being used, advance the query iterator here.
65 $wp_query->next_post();
67 setup_postdata($post);
71 * Return or Print Category ID.
75 * @deprecated use get_the_category()
76 * @see get_the_category()
81 function the_category_ID($echo = true) {
82 _deprecated_function( __FUNCTION__, '0.71', 'get_the_category()' );
84 // Grab the first cat in the list.
85 $categories = get_the_category();
86 $cat = $categories[0]->term_id;
95 * Print category with optional text before and after.
99 * @deprecated use get_the_category_by_ID()
100 * @see get_the_category_by_ID()
102 * @param string $before
103 * @param string $after
105 function the_category_head($before='', $after='') {
106 global $currentcat, $previouscat;
108 _deprecated_function( __FUNCTION__, '0.71', 'get_the_category_by_ID()' );
110 // Grab the first cat in the list.
111 $categories = get_the_category();
112 $currentcat = $categories[0]->category_id;
113 if ( $currentcat != $previouscat ) {
115 echo get_the_category_by_ID($currentcat);
117 $previouscat = $currentcat;
122 * Prints link to the previous post.
126 * @deprecated Use previous_post_link()
127 * @see previous_post_link()
129 * @param string $format
130 * @param string $previous
131 * @param string $title
132 * @param string $in_same_cat
133 * @param int $limitprev
134 * @param string $excluded_categories
136 function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') {
138 _deprecated_function( __FUNCTION__, '2.0', 'previous_post_link()' );
140 if ( empty($in_same_cat) || 'no' == $in_same_cat )
141 $in_same_cat = false;
145 $post = get_previous_post($in_same_cat, $excluded_categories);
150 $string = '<a href="'.get_permalink($post->ID).'">'.$previous;
151 if ( 'yes' == $title )
152 $string .= apply_filters('the_title', $post->post_title, $post);
154 $format = str_replace('%', $string, $format);
159 * Prints link to the next post.
163 * @deprecated Use next_post_link()
164 * @see next_post_link()
166 * @param string $format
167 * @param string $previous
168 * @param string $title
169 * @param string $in_same_cat
170 * @param int $limitprev
171 * @param string $excluded_categories
173 function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') {
174 _deprecated_function( __FUNCTION__, '2.0', 'next_post_link()' );
176 if ( empty($in_same_cat) || 'no' == $in_same_cat )
177 $in_same_cat = false;
181 $post = get_next_post($in_same_cat, $excluded_categories);
186 $string = '<a href="'.get_permalink($post->ID).'">'.$next;
187 if ( 'yes' == $title )
188 $string .= apply_filters('the_title', $post->post_title, $nextpost);
190 $format = str_replace('%', $string, $format);
195 * Whether user can create a post.
199 * @deprecated Use current_user_can()
200 * @see current_user_can()
202 * @param int $user_id
203 * @param int $blog_id Not Used
204 * @param int $category_id Not Used
207 function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') {
208 _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
210 $author_data = get_userdata($user_id);
211 return ($author_data->user_level > 1);
215 * Whether user can create a post.
219 * @deprecated Use current_user_can()
220 * @see current_user_can()
222 * @param int $user_id
223 * @param int $blog_id Not Used
224 * @param int $category_id Not Used
227 function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') {
228 _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
230 $author_data = get_userdata($user_id);
231 return ($author_data->user_level >= 1);
235 * Whether user can edit a post.
239 * @deprecated Use current_user_can()
240 * @see current_user_can()
242 * @param int $user_id
243 * @param int $post_id
244 * @param int $blog_id Not Used
247 function user_can_edit_post($user_id, $post_id, $blog_id = 1) {
248 _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
250 $author_data = get_userdata($user_id);
251 $post = get_post($post_id);
252 $post_author_data = get_userdata($post->post_author);
254 if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2))
255 || ($author_data->user_level > $post_author_data->user_level)
256 || ($author_data->user_level >= 10) ) {
264 * Whether user can delete a post.
268 * @deprecated Use current_user_can()
269 * @see current_user_can()
271 * @param int $user_id
272 * @param int $post_id
273 * @param int $blog_id Not Used
276 function user_can_delete_post($user_id, $post_id, $blog_id = 1) {
277 _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
279 // right now if one can edit, one can delete
280 return user_can_edit_post($user_id, $post_id, $blog_id);
284 * Whether user can set new posts' dates.
288 * @deprecated Use current_user_can()
289 * @see current_user_can()
291 * @param int $user_id
292 * @param int $blog_id Not Used
293 * @param int $category_id Not Used
296 function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') {
297 _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
299 $author_data = get_userdata($user_id);
300 return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id));
304 * Whether user can delete a post.
308 * @deprecated Use current_user_can()
309 * @see current_user_can()
311 * @param int $user_id
312 * @param int $post_id
313 * @param int $blog_id Not Used
314 * @return bool returns true if $user_id can edit $post_id's date
316 function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) {
317 _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
319 $author_data = get_userdata($user_id);
320 return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id));
324 * Whether user can delete a post.
328 * @deprecated Use current_user_can()
329 * @see current_user_can()
331 * @param int $user_id
332 * @param int $post_id
333 * @param int $blog_id Not Used
334 * @return bool returns true if $user_id can edit $post_id's comments
336 function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) {
337 _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
339 // right now if one can edit a post, one can edit comments made on it
340 return user_can_edit_post($user_id, $post_id, $blog_id);
344 * Whether user can delete a post.
348 * @deprecated Use current_user_can()
349 * @see current_user_can()
351 * @param int $user_id
352 * @param int $post_id
353 * @param int $blog_id Not Used
354 * @return bool returns true if $user_id can delete $post_id's comments
356 function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) {
357 _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
359 // right now if one can edit comments, one can delete comments
360 return user_can_edit_post_comments($user_id, $post_id, $blog_id);
364 * Can user can edit other user.
368 * @deprecated Use current_user_can()
369 * @see current_user_can()
371 * @param int $user_id
372 * @param int $other_user
375 function user_can_edit_user($user_id, $other_user) {
376 _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
378 $user = get_userdata($user_id);
379 $other = get_userdata($other_user);
380 if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID )
387 * Gets the links associated with category $cat_name.
391 * @deprecated Use get_bookmarks()
392 * @see get_bookmarks()
394 * @param string $cat_name Optional. The category name to use. If no match is found uses all.
395 * @param string $before Optional. The html to output before the link.
396 * @param string $after Optional. The html to output after the link.
397 * @param string $between Optional. The html to output between the link/image and it's description. Not used if no image or $show_images is true.
398 * @param bool $show_images Optional. Whether to show images (if defined).
399 * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', 'description' or 'rating'. Or maybe owner.
400 * If you start the name with an underscore the order will be reversed. You can also specify 'rand' as the order which will return links in a
402 * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined.
403 * @param bool $show_rating Optional. Show rating stars/chars.
404 * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown.
405 * @param int $show_updated Optional. Whether to show last updated timestamp
407 function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = true, $orderby = 'id',
408 $show_description = true, $show_rating = false,
409 $limit = -1, $show_updated = 0) {
410 _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' );
413 $cat = get_term_by('name', $cat_name, 'link_category');
415 $cat_id = $cat->term_id;
417 get_links($cat_id, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated);
421 * Gets the links associated with the named category.
425 * @deprecated Use wp_list_bookmarks()
426 * @see wp_list_bookmarks()
428 * @param string $category The category to use.
429 * @param string $args
432 function wp_get_linksbyname($category, $args = '') {
433 _deprecated_function(__FUNCTION__, '0.0', 'wp_list_bookmarks()');
439 'category_after' => '',
440 'category_before' => '',
441 'category_name' => $category,
442 'show_description' => 1,
446 $r = wp_parse_args( $args, $defaults );
448 return wp_list_bookmarks($r);
452 * Gets an array of link objects associated with category $cat_name.
455 * $links = get_linkobjectsbyname('fred');
456 * foreach ($links as $link) {
457 * echo '<li>'.$link->link_name.'</li>';
463 * @deprecated Use get_bookmarks()
464 * @see get_bookmarks()
466 * @param string $cat_name The category name to use. If no match is found uses all.
467 * @param string $orderby The order to output the links. E.g. 'id', 'name', 'url', 'description', or 'rating'.
468 * Or maybe owner. If you start the name with an underscore the order will be reversed. You can also
469 * specify 'rand' as the order which will return links in a random order.
470 * @param int $limit Limit to X entries. If not specified, all entries are shown.
473 function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) {
474 _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' );
477 $cat = get_term_by('name', $cat_name, 'link_category');
479 $cat_id = $cat->term_id;
481 return get_linkobjects($cat_id, $orderby, $limit);
485 * Gets an array of link objects associated with category n.
489 * $links = get_linkobjects(1);
491 * foreach ($links as $link) {
492 * echo '<li>'.$link->link_name.'<br />'.$link->link_description.'</li>';
502 * <li>link_image</li>
503 * <li>link_target</li>
504 * <li>link_category</li>
505 * <li>link_description</li>
506 * <li>link_visible</li>
507 * <li>link_owner</li>
508 * <li>link_rating</li>
509 * <li>link_updated</li>
511 * <li>link_notes</li>
516 * @deprecated Use get_bookmarks()
517 * @see get_bookmarks()
519 * @param int $category The category to use. If no category supplied uses all
520 * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url',
521 * 'description', or 'rating'. Or maybe owner. If you start the name with an
522 * underscore the order will be reversed. You can also specify 'rand' as the
523 * order which will return links in a random order.
524 * @param int $limit Limit to X entries. If not specified, all entries are shown.
527 function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) {
528 _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' );
530 $links = get_bookmarks( array( 'category' => $category, 'orderby' => $orderby, 'limit' => $limit ) ) ;
532 $links_array = array();
533 foreach ($links as $link)
534 $links_array[] = $link;
540 * Gets the links associated with category 'cat_name' and display rating stars/chars.
544 * @deprecated Use get_bookmarks()
545 * @see get_bookmarks()
547 * @param string $cat_name The category name to use. If no match is found uses all
548 * @param string $before The html to output before the link
549 * @param string $after The html to output after the link
550 * @param string $between The html to output between the link/image and it's description. Not used if no image or show_images is true
551 * @param bool $show_images Whether to show images (if defined).
552 * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url',
553 * 'description', or 'rating'. Or maybe owner. If you start the name with an
554 * underscore the order will be reversed. You can also specify 'rand' as the
555 * order which will return links in a random order.
556 * @param bool $show_description Whether to show the description if show_images=false/not defined
557 * @param int $limit Limit to X entries. If not specified, all entries are shown.
558 * @param int $show_updated Whether to show last updated timestamp
560 function get_linksbyname_withrating($cat_name = "noname", $before = '', $after = '<br />', $between = " ",
561 $show_images = true, $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) {
562 _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' );
564 get_linksbyname($cat_name, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated);
568 * Gets the links associated with category n and display rating stars/chars.
572 * @deprecated Use get_bookmarks()
573 * @see get_bookmarks()
575 * @param int $category The category to use. If no category supplied uses all
576 * @param string $before The html to output before the link
577 * @param string $after The html to output after the link
578 * @param string $between The html to output between the link/image and it's description. Not used if no image or show_images == true
579 * @param bool $show_images Whether to show images (if defined).
580 * @param string $orderby The order to output the links. E.g. 'id', 'name', 'url',
581 * 'description', or 'rating'. Or maybe owner. If you start the name with an
582 * underscore the order will be reversed. You can also specify 'rand' as the
583 * order which will return links in a random order.
584 * @param bool $show_description Whether to show the description if show_images=false/not defined.
585 * @param string $limit Limit to X entries. If not specified, all entries are shown.
586 * @param int $show_updated Whether to show last updated timestamp
588 function get_links_withrating($category = -1, $before = '', $after = '<br />', $between = " ", $show_images = true,
589 $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) {
590 _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' );
592 get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated);
596 * Gets the auto_toggle setting.
600 * @deprecated No alternative function available
602 * @param int $id The category to get. If no category supplied uses 0
603 * @return int Only returns 0.
605 function get_autotoggle($id = 0) {
606 _deprecated_function( __FUNCTION__, '2.1' );
613 * @deprecated Use wp_list_categories()
614 * @see wp_list_categories()
616 * @param int $optionall
618 * @param string $sort_column
619 * @param string $sort_order
620 * @param string $file
622 * @param int $optiondates
623 * @param int $optioncount
624 * @param int $hide_empty
625 * @param int $use_desc_for_title
626 * @param bool $children
627 * @param int $child_of
628 * @param int $categories
629 * @param int $recurse
630 * @param string $feed
631 * @param string $feed_image
632 * @param string $exclude
633 * @param bool $hierarchical
636 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0,
637 $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0,
638 $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) {
639 _deprecated_function( __FUNCTION__, '2.1', 'wp_list_categories()' );
641 $query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children',
642 'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical');
643 return wp_list_cats($query);
649 * @deprecated Use wp_list_categories()
650 * @see wp_list_categories()
652 * @param string|array $args
655 function wp_list_cats($args = '') {
656 _deprecated_function( __FUNCTION__, '2.1', 'wp_list_categories()' );
658 $r = wp_parse_args( $args );
661 if ( isset($r['optionall']) && isset($r['all']))
662 $r['show_option_all'] = $r['all'];
663 if ( isset($r['sort_column']) )
664 $r['orderby'] = $r['sort_column'];
665 if ( isset($r['sort_order']) )
666 $r['order'] = $r['sort_order'];
667 if ( isset($r['optiondates']) )
668 $r['show_last_update'] = $r['optiondates'];
669 if ( isset($r['optioncount']) )
670 $r['show_count'] = $r['optioncount'];
671 if ( isset($r['list']) )
672 $r['style'] = $r['list'] ? 'list' : 'break';
675 return wp_list_categories($r);
681 * @deprecated Use wp_dropdown_categories()
682 * @see wp_dropdown_categories()
684 * @param int $optionall
686 * @param string $orderby
687 * @param string $order
688 * @param int $show_last_update
689 * @param int $show_count
690 * @param int $hide_empty
691 * @param bool $optionnone
692 * @param int $selected
693 * @param int $exclude
696 function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc',
697 $show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = false,
698 $selected = 0, $exclude = 0) {
699 _deprecated_function( __FUNCTION__, '2.1', 'wp_dropdown_categories()' );
701 $show_option_all = '';
703 $show_option_all = $all;
705 $show_option_none = '';
707 $show_option_none = __('None');
709 $vars = compact('show_option_all', 'show_option_none', 'orderby', 'order',
710 'show_last_update', 'show_count', 'hide_empty', 'selected', 'exclude');
711 $query = add_query_arg($vars, '');
712 return wp_dropdown_categories($query);
718 * @deprecated Use wp_list_authors()
719 * @see wp_list_authors()
721 * @param bool $optioncount
722 * @param bool $exclude_admin
723 * @param bool $show_fullname
724 * @param bool $hide_empty
725 * @param string $feed
726 * @param string $feed_image
729 function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') {
730 _deprecated_function( __FUNCTION__, '2.1', 'wp_list_authors()' );
732 $args = compact('optioncount', 'exclude_admin', 'show_fullname', 'hide_empty', 'feed', 'feed_image');
733 return wp_list_authors($args);
739 * @deprecated Use wp_get_post_categories()
740 * @see wp_get_post_categories()
742 * @param int $blogid Not Used
743 * @param int $post_ID
746 function wp_get_post_cats($blogid = '1', $post_ID = 0) {
747 _deprecated_function( __FUNCTION__, '2.1', 'wp_get_post_categories()' );
748 return wp_get_post_categories($post_ID);
752 * Sets the categories that the post id belongs to.
756 * @deprecated Use wp_set_post_categories()
757 * @see wp_set_post_categories()
759 * @param int $blogid Not used
760 * @param int $post_ID
761 * @param array $post_categories
764 function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) {
765 _deprecated_function( __FUNCTION__, '2.1', 'wp_set_post_categories()' );
766 return wp_set_post_categories($post_ID, $post_categories);
772 * @deprecated Use wp_get_archives()
773 * @see wp_get_archives()
775 * @param string $type
776 * @param string $limit
777 * @param string $format
778 * @param string $before
779 * @param string $after
780 * @param bool $show_post_count
783 function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) {
784 _deprecated_function( __FUNCTION__, '2.1', 'wp_get_archives()' );
785 $args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count');
786 return wp_get_archives($args);
790 * Returns or Prints link to the author's posts.
794 * @deprecated Use get_author_posts_url()
795 * @see get_author_posts_url()
797 * @param bool $echo Optional.
798 * @param int $author_id Required.
799 * @param string $author_nicename Optional.
800 * @return string|null
802 function get_author_link($echo = false, $author_id, $author_nicename = '') {
803 _deprecated_function( __FUNCTION__, '2.1', 'get_author_posts_url()' );
805 $link = get_author_posts_url($author_id, $author_nicename);
813 * Print list of pages based on arguments.
817 * @deprecated Use wp_link_pages()
818 * @see wp_link_pages()
820 * @param string $before
821 * @param string $after
822 * @param string $next_or_number
823 * @param string $nextpagelink
824 * @param string $previouspagelink
825 * @param string $pagelink
826 * @param string $more_file
829 function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page',
830 $pagelink='%', $more_file='') {
831 _deprecated_function( __FUNCTION__, '2.1', 'wp_link_pages()' );
833 $args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file');
834 return wp_link_pages($args);
838 * Get value based on option.
842 * @deprecated Use get_option()
845 * @param string $option
848 function get_settings($option) {
849 _deprecated_function( __FUNCTION__, '2.1', 'get_option()' );
851 return get_option($option);
855 * Print the permalink of the current post in the loop.
859 * @deprecated Use the_permalink()
860 * @see the_permalink()
862 function permalink_link() {
863 _deprecated_function( __FUNCTION__, '1.2', 'the_permalink()' );
868 * Print the permalink to the RSS feed.
872 * @deprecated Use the_permalink_rss()
873 * @see the_permalink_rss()
875 * @param string $file
877 function permalink_single_rss($deprecated = '') {
878 _deprecated_function( __FUNCTION__, '0.0', 'the_permalink_rss()' );
883 * Gets the links associated with category.
885 * @see get_links() for argument information that can be used in $args
888 * @deprecated Use wp_list_bookmarks()
889 * @see wp_list_bookmarks()
891 * @param string $args a query string
892 * @return null|string
894 function wp_get_links($args = '') {
895 _deprecated_function( __FUNCTION__, '0.0', 'wp_list_bookmarks()' );
897 if ( strpos( $args, '=' ) === false ) {
899 $args = add_query_arg( 'category', $cat_id, $args );
911 'show_description' => true,
912 'show_images' => true,
913 'show_rating' => false,
914 'show_updated' => true,
918 $r = wp_parse_args( $args, $defaults );
920 return wp_list_bookmarks($r);
924 * Gets the links associated with category by id.
928 * @deprecated Use get_bookmarks()
929 * @see get_bookmarks()
931 * @param int $category The category to use. If no category supplied uses all
932 * @param string $before the html to output before the link
933 * @param string $after the html to output after the link
934 * @param string $between the html to output between the link/image and its description.
935 * Not used if no image or show_images == true
936 * @param bool $show_images whether to show images (if defined).
937 * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url',
938 * 'description', or 'rating'. Or maybe owner. If you start the name with an
939 * underscore the order will be reversed. You can also specify 'rand' as the order
940 * which will return links in a random order.
941 * @param bool $show_description whether to show the description if show_images=false/not defined.
942 * @param bool $show_rating show rating stars/chars
943 * @param int $limit Limit to X entries. If not specified, all entries are shown.
944 * @param int $show_updated whether to show last updated timestamp
945 * @param bool $echo whether to echo the results, or return them instead
946 * @return null|string
948 function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name',
949 $show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $echo = true) {
950 _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' );
953 if ( substr($orderby, 0, 1) == '_' ) {
955 $orderby = substr($orderby, 1);
958 if ( $category == -1 ) //get_bookmarks uses '' to signify all categories
961 $results = get_bookmarks(array('category' => $category, 'orderby' => $orderby, 'order' => $order, 'show_updated' => $show_updated, 'limit' => $limit));
968 foreach ( (array) $results as $row ) {
969 if ( !isset($row->recently_updated) )
970 $row->recently_updated = false;
972 if ( $show_updated && $row->recently_updated )
973 $output .= get_option('links_recently_updated_prepend');
975 if ( !empty($row->link_url) )
976 $the_link = esc_url($row->link_url);
977 $rel = $row->link_rel;
979 $rel = ' rel="' . $rel . '"';
981 $desc = esc_attr(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display'));
982 $name = esc_attr(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display'));
986 if (substr($row->link_updated_f, 0, 2) != '00')
987 $title .= ' ('.__('Last updated') . ' ' . date(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * 3600)) . ')';
990 $title = ' title="' . $title . '"';
992 $alt = ' alt="' . $name . '"';
994 $target = $row->link_target;
996 $target = ' target="' . $target . '"';
998 $output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>';
1000 if ( $row->link_image != null && $show_images ) {
1001 if ( strpos($row->link_image, 'http') !== false )
1002 $output .= "<img src=\"$row->link_image\" $alt $title />";
1003 else // If it's a relative path
1004 $output .= "<img src=\"" . get_option('siteurl') . "$row->link_image\" $alt $title />";
1011 if ( $show_updated && $row->recently_updated )
1012 $output .= get_option('links_recently_updated_append');
1014 if ( $show_description && '' != $desc )
1015 $output .= $between . $desc;
1018 $output .= $between . get_linkrating($row);
1021 $output .= "$after\n";
1030 * Output entire list of links by category.
1032 * Output a list of all links, listed by category, using the settings in
1033 * $wpdb->linkcategories and output it as a nested HTML unordered list.
1037 * @deprecated Use wp_list_bookmarks()
1038 * @see wp_list_bookmarks()
1040 * @param string $order Sort link categories by 'name' or 'id'
1042 function get_links_list($order = 'name') {
1043 _deprecated_function( __FUNCTION__, '2.1', 'wp_list_bookmarks()' );
1045 $order = strtolower($order);
1047 // Handle link category sorting
1049 if ( '_' == substr($order,0,1) ) {
1050 $direction = 'DESC';
1051 $order = substr($order,1);
1054 if ( !isset($direction) )
1057 $cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0));
1059 // Display each category
1061 foreach ( (array) $cats as $cat ) {
1062 // Handle each category.
1064 // Display the category name
1065 echo ' <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name ) . "</h2>\n\t<ul>\n";
1066 // Call get_links() with all the appropriate params
1067 get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false);
1069 // Close the last category
1070 echo "\n\t</ul>\n</li>\n";
1076 * Show the link to the links popup and the number of links.
1080 * @deprecated {@internal Use function instead is unknown}}
1082 * @param string $text the text of the link
1083 * @param int $width the width of the popup window
1084 * @param int $height the height of the popup window
1085 * @param string $file the page to open in the popup window
1086 * @param bool $count the number of links in the db
1088 function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) {
1089 _deprecated_function( __FUNCTION__, '2.1' );
1092 $counts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->links");
1094 $javascript = "<a href=\"#\" onclick=\"javascript:window.open('$file?popup=1', '_blank', 'width=$width,height=$height,scrollbars=yes,status=no'); return false\">";
1095 $javascript .= $text;
1098 $javascript .= " ($counts)";
1100 $javascript .= "</a>\n\n";
1107 * @deprecated Use sanitize_bookmark_field()
1108 * @see sanitize_bookmark_field()
1110 * @param object $link
1113 function get_linkrating($link) {
1114 _deprecated_function( __FUNCTION__, '2.1', 'sanitize_bookmark_field()' );
1115 return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display');
1119 * Gets the name of category by id.
1123 * @deprecated Use get_category()
1124 * @see get_category()
1126 * @param int $id The category to get. If no category supplied uses 0
1129 function get_linkcatname($id = 0) {
1130 _deprecated_function( __FUNCTION__, '2.1', 'get_category()' );
1137 $cats = wp_get_link_cats($id);
1139 if ( empty($cats) || ! is_array($cats) )
1142 $cat_id = (int) $cats[0]; // Take the first cat.
1144 $cat = get_category($cat_id);
1149 * Print RSS comment feed link.
1153 * @deprecated Use post_comments_feed_link()
1154 * @see post_comments_feed_link()
1156 * @param string $link_text
1158 function comments_rss_link($link_text = 'Comments RSS') {
1159 _deprecated_function( __FUNCTION__, '2.5', 'post_comments_feed_link()' );
1160 post_comments_feed_link($link_text);
1164 * Print/Return link to category RSS2 feed.
1168 * @deprecated Use get_category_feed_link()
1169 * @see get_category_feed_link()
1172 * @param int $cat_ID
1173 * @return string|null
1175 function get_category_rss_link($echo = false, $cat_ID = 1) {
1176 _deprecated_function( __FUNCTION__, '2.5', 'get_category_feed_link()' );
1178 $link = get_category_feed_link($cat_ID, 'rss2');
1186 * Print/Return link to author RSS feed.
1190 * @deprecated Use get_author_feed_link()
1191 * @see get_author_feed_link()
1194 * @param int $author_id
1195 * @return string|null
1197 function get_author_rss_link($echo = false, $author_id = 1) {
1198 _deprecated_function( __FUNCTION__, '2.5', 'get_author_feed_link()' );
1200 $link = get_author_feed_link($author_id);
1207 * Return link to the post RSS feed.
1211 * @deprecated Use get_post_comments_feed_link()
1212 * @see get_post_comments_feed_link()
1216 function comments_rss() {
1217 _deprecated_function( __FUNCTION__, '2.2', 'get_post_comments_feed_link()' );
1218 return get_post_comments_feed_link();
1222 * An alias of wp_create_user().
1226 * @deprecated Use wp_create_user()
1227 * @see wp_create_user()
1229 * @param string $username The user's username.
1230 * @param string $password The user's password.
1231 * @param string $email The user's email (optional).
1232 * @return int The new user's ID.
1234 function create_user($username, $password, $email) {
1235 _deprecated_function( __FUNCTION__, '2.0', 'wp_create_user()' );
1236 return wp_create_user($username, $password, $email);
1244 function gzip_compression() {
1245 _deprecated_function( __FUNCTION__, '2.5' );
1250 * Retrieve an array of comment data about comment $comment_ID.
1254 * @deprecated Use get_comment()
1255 * @see get_comment()
1257 * @param int $comment_ID The ID of the comment
1258 * @param int $no_cache Whether to use the cache (cast to bool)
1259 * @param bool $include_unapproved Whether to include unapproved comments
1260 * @return array The comment data
1262 function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) {
1263 _deprecated_function( __FUNCTION__, '2.7', 'get_comment()' );
1264 return get_comment($comment_ID, ARRAY_A);
1268 * Retrieve the category name by the category ID.
1272 * @deprecated Use get_cat_name()
1273 * @see get_cat_name()
1275 * @param int $cat_ID Category ID
1276 * @return string category name
1278 function get_catname( $cat_ID ) {
1279 _deprecated_function( __FUNCTION__, '2.8', 'get_cat_name()' );
1280 return get_cat_name( $cat_ID );
1284 * Retrieve category children list separated before and after the term IDs.
1288 * @deprecated Use get_term_children()
1289 * @see get_term_children()
1291 * @param int $id Category ID to retrieve children.
1292 * @param string $before Optional. Prepend before category term ID.
1293 * @param string $after Optional, default is empty string. Append after category term ID.
1294 * @param array $visited Optional. Category Term IDs that have already been added.
1297 function get_category_children( $id, $before = '/', $after = '', $visited = array() ) {
1298 _deprecated_function( __FUNCTION__, '2.8', 'get_term_children()' );
1303 /** TODO: consult hierarchy */
1304 $cat_ids = get_all_category_ids();
1305 foreach ( (array) $cat_ids as $cat_id ) {
1306 if ( $cat_id == $id )
1309 $category = get_category( $cat_id );
1310 if ( is_wp_error( $category ) )
1312 if ( $category->parent == $id && !in_array( $category->term_id, $visited ) ) {
1313 $visited[] = $category->term_id;
1314 $chain .= $before.$category->term_id.$after;
1315 $chain .= get_category_children( $category->term_id, $before, $after );
1322 * Retrieve the description of the author of the current post.
1326 * @deprecated Use the_author_meta('description')
1327 * @see get_the_author_meta()
1329 * @return string The author's description.
1331 function get_the_author_description() {
1332 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'description\')' );
1333 return get_the_author_meta('description');
1337 * Display the description of the author of the current post.
1341 * @deprecated Use the_author_meta('description')
1342 * @see the_author_meta()
1344 function the_author_description() {
1345 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'description\')' );
1346 the_author_meta('description');
1350 * Retrieve the login name of the author of the current post.
1354 * @deprecated Use the_author_meta('login')
1355 * @see get_the_author_meta()
1357 * @return string The author's login name (username).
1359 function get_the_author_login() {
1360 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'login\')' );
1361 return get_the_author_meta('login');
1365 * Display the login name of the author of the current post.
1369 * @deprecated Use the_author_meta('login')
1370 * @see the_author_meta()
1372 function the_author_login() {
1373 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'login\')' );
1374 the_author_meta('login');
1378 * Retrieve the first name of the author of the current post.
1382 * @deprecated Use the_author_meta('first_name')
1383 * @see get_the_author_meta()
1385 * @return string The author's first name.
1387 function get_the_author_firstname() {
1388 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'first_name\')' );
1389 return get_the_author_meta('first_name');
1393 * Display the first name of the author of the current post.
1397 * @deprecated Use the_author_meta('first_name')
1398 * @see the_author_meta()
1400 function the_author_firstname() {
1401 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'first_name\')' );
1402 the_author_meta('first_name');
1406 * Retrieve the last name of the author of the current post.
1410 * @deprecated Use get_the_author_meta('last_name')
1411 * @see get_the_author_meta()
1413 * @return string The author's last name.
1415 function get_the_author_lastname() {
1416 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'last_name\')' );
1417 return get_the_author_meta('last_name');
1421 * Display the last name of the author of the current post.
1425 * @deprecated Use the_author_meta('last_name')
1426 * @see the_author_meta()
1428 function the_author_lastname() {
1429 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'last_name\')' );
1430 the_author_meta('last_name');
1434 * Retrieve the nickname of the author of the current post.
1438 * @deprecated Use get_the_author_meta('nickname')
1439 * @see get_the_author_meta()
1441 * @return string The author's nickname.
1443 function get_the_author_nickname() {
1444 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'nickname\')' );
1445 return get_the_author_meta('nickname');
1449 * Display the nickname of the author of the current post.
1453 * @deprecated Use the_author_meta('nickname')
1454 * @see the_author_meta()
1456 function the_author_nickname() {
1457 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'nickname\')' );
1458 the_author_meta('nickname');
1462 * Retrieve the email of the author of the current post.
1466 * @deprecated Use get_the_author_meta('email')
1467 * @see get_the_author_meta()
1469 * @return string The author's username.
1471 function get_the_author_email() {
1472 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'email\')' );
1473 return get_the_author_meta('email');
1477 * Display the email of the author of the current post.
1481 * @deprecated Use the_author_meta('email')
1482 * @see the_author_meta()
1484 function the_author_email() {
1485 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'email\')' );
1486 the_author_meta('email');
1490 * Retrieve the ICQ number of the author of the current post.
1494 * @deprecated Use get_the_author_meta('icq')
1495 * @see get_the_author_meta()
1497 * @return string The author's ICQ number.
1499 function get_the_author_icq() {
1500 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'icq\')' );
1501 return get_the_author_meta('icq');
1505 * Display the ICQ number of the author of the current post.
1509 * @deprecated Use the_author_meta('icq')
1510 * @see the_author_meta()
1512 function the_author_icq() {
1513 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'icq\')' );
1514 the_author_meta('icq');
1518 * Retrieve the Yahoo! IM name of the author of the current post.
1522 * @deprecated Use get_the_author_meta('yim')
1523 * @see get_the_author_meta()
1525 * @return string The author's Yahoo! IM name.
1527 function get_the_author_yim() {
1528 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'yim\')' );
1529 return get_the_author_meta('yim');
1533 * Display the Yahoo! IM name of the author of the current post.
1537 * @deprecated Use the_author_meta('yim')
1538 * @see the_author_meta()
1540 function the_author_yim() {
1541 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'yim\')' );
1542 the_author_meta('yim');
1546 * Retrieve the MSN address of the author of the current post.
1550 * @deprecated Use get_the_author_meta('msn')
1551 * @see get_the_author_meta()
1553 * @return string The author's MSN address.
1555 function get_the_author_msn() {
1556 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'msn\')' );
1557 return get_the_author_meta('msn');
1561 * Display the MSN address of the author of the current post.
1565 * @deprecated Use the_author_meta('msn')
1566 * @see the_author_meta()
1568 function the_author_msn() {
1569 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'msn\')' );
1570 the_author_meta('msn');
1574 * Retrieve the AIM address of the author of the current post.
1578 * @deprecated Use get_the_author_meta('aim')
1579 * @see get_the_author_meta()
1581 * @return string The author's AIM address.
1583 function get_the_author_aim() {
1584 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'aim\')' );
1585 return get_the_author_meta('aim');
1589 * Display the AIM address of the author of the current post.
1592 * @see the_author_meta()
1594 * @deprecated Use the_author_meta('aim')
1596 function the_author_aim() {
1597 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'aim\')' );
1598 the_author_meta('aim');
1602 * Retrieve the specified author's preferred display name.
1606 * @deprecated Use get_the_author_meta('display_name')
1607 * @see get_the_author_meta()
1609 * @param int $auth_id The ID of the author.
1610 * @return string The author's display name.
1612 function get_author_name( $auth_id = false ) {
1613 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'display_name\')' );
1614 return get_the_author_meta('display_name', $auth_id);
1618 * Retrieve the URL to the home page of the author of the current post.
1622 * @deprecated Use get_the_author_meta('url')
1623 * @see get_the_author_meta()
1625 * @return string The URL to the author's page.
1627 function get_the_author_url() {
1628 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'url\')' );
1629 return get_the_author_meta('url');
1633 * Display the URL to the home page of the author of the current post.
1637 * @deprecated Use the_author_meta('url')
1638 * @see the_author_meta()
1640 function the_author_url() {
1641 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'url\')' );
1642 the_author_meta('url');
1646 * Retrieve the ID of the author of the current post.
1650 * @deprecated Use get_the_author_meta('ID')
1651 * @see get_the_author_meta()
1653 * @return int The author's ID.
1655 function get_the_author_ID() {
1656 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'ID\')' );
1657 return get_the_author_meta('ID');
1661 * Display the ID of the author of the current post.
1665 * @deprecated Use the_author_meta('ID')
1666 * @see the_author_meta()
1668 function the_author_ID() {
1669 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'ID\')' );
1670 the_author_meta('ID');
1674 * Display the post content for the feed.
1676 * For encoding the html or the $encode_html parameter, there are three possible
1677 * values. '0' will make urls footnotes and use make_url_footnote(). '1' will
1678 * encode special characters and automatically display all of the content. The
1679 * value of '2' will strip all HTML tags from the content.
1681 * Also note that you cannot set the amount of words and not set the html
1682 * encoding. If that is the case, then the html encoding will default to 2,
1683 * which will strip all HTML tags.
1685 * To restrict the amount of words of the content, you can use the cut
1686 * parameter. If the content is less than the amount, then there won't be any
1687 * dots added to the end. If there is content left over, then dots will be added
1688 * and the rest of the content will be removed.
1690 * @package WordPress
1693 * @uses apply_filters() Calls 'the_content_rss' on the content before processing.
1694 * @see get_the_content() For the $more_link_text, $stripteaser, and $more_file
1698 * @deprecated Use the_content_feed()
1699 * @see the_content_feed()
1701 * @param string $more_link_text Optional. Text to display when more content is available but not displayed.
1702 * @param int|bool $stripteaser Optional. Default is 0.
1703 * @param string $more_file Optional.
1704 * @param int $cut Optional. Amount of words to keep for the content.
1705 * @param int $encode_html Optional. How to encode the content.
1707 function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) {
1708 _deprecated_function( __FUNCTION__, '2.9', 'the_content_feed' );
1709 $content = get_the_content($more_link_text, $stripteaser, $more_file);
1710 $content = apply_filters('the_content_rss', $content);
1711 if ( $cut && !$encode_html )
1713 if ( 1== $encode_html ) {
1714 $content = esc_html($content);
1716 } elseif ( 0 == $encode_html ) {
1717 $content = make_url_footnote($content);
1718 } elseif ( 2 == $encode_html ) {
1719 $content = strip_tags($content);
1722 $blah = explode(' ', $content);
1723 if ( count($blah) > $cut ) {
1731 /** @todo Check performance, might be faster to use array slice instead. */
1732 for ( $i=0; $i<$k; $i++ )
1733 $excerpt .= $blah[$i].' ';
1734 $excerpt .= ($use_dotdotdot) ? '...' : '';
1735 $content = $excerpt;
1737 $content = str_replace(']]>', ']]>', $content);
1742 * Strip HTML and put links at the bottom of stripped content.
1744 * Searches for all of the links, strips them out of the content, and places
1745 * them at the bottom of the content with numbers.
1750 * @param string $content Content to get links
1751 * @return string HTML stripped out of content with links at the bottom.
1753 function make_url_footnote( $content ) {
1754 _deprecated_function( __FUNCTION__, '2.9', '' );
1755 preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches );
1756 $links_summary = "\n";
1757 for ( $i=0; $i<count($matches[0]); $i++ ) {
1758 $link_match = $matches[0][$i];
1759 $link_number = '['.($i+1).']';
1760 $link_url = $matches[2][$i];
1761 $link_text = $matches[4][$i];
1762 $content = str_replace( $link_match, $link_text . ' ' . $link_number, $content );
1763 $link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url;
1764 $links_summary .= "\n" . $link_number . ' ' . $link_url;
1766 $content = strip_tags( $content );
1767 $content .= $links_summary;
1772 * Retrieve translated string with vertical bar context
1774 * Quite a few times, there will be collisions with similar translatable text
1775 * found in more than two places but with different translated context.
1777 * In order to use the separate contexts, the _c() function is used and the
1778 * translatable string uses a pipe ('|') which has the context the string is in.
1780 * When the translated string is returned, it is everything before the pipe, not
1781 * including the pipe character. If there is no pipe in the translated text then
1782 * everything is returned.
1786 * @deprecated Use _x()
1789 * @param string $text Text to translate
1790 * @param string $domain Optional. Domain to retrieve the translated text
1791 * @return string Translated context string without pipe
1793 function _c( $text, $domain = 'default' ) {
1794 _deprecated_function( __FUNCTION__, '2.9', '_x()' );
1795 return before_last_bar( translate( $text, $domain ) );
1799 * Translates $text like translate(), but assumes that the text
1800 * contains a context after its last vertical bar.
1805 * @deprecated Use _x()
1808 * @param string $text Text to translate
1809 * @param string $domain Domain to retrieve the translated text
1810 * @return string Translated text
1812 function translate_with_context( $text, $domain = 'default' ) {
1813 _deprecated_function( __FUNCTION__, '2.9', '_x()' );
1814 return before_last_bar( translate( $text, $domain ) );
1818 * A version of _n(), which supports contexts.
1819 * Strips everything from the translation after the last bar.
1823 * @deprecated Use _nx()
1825 * @see _n() For parameters.
1826 * @see _c() For parameters. _c() is deprecated.
1829 function _nc( $single, $plural, $number, $domain = 'default' ) {
1830 _deprecated_function( __FUNCTION__, '2.9', '_nx()' );
1831 return before_last_bar( _n( $single, $plural, $number, $domain ) );
1835 * Retrieve the plural or single form based on the amount.
1839 * @deprecated Use _n()
1842 function __ngettext() {
1843 _deprecated_function( __FUNCTION__, '2.8', '_n()' );
1844 $args = func_get_args();
1845 return call_user_func_array('_n', $args);
1849 * Register plural strings in POT file, but don't translate them.
1853 * @deprecated Use _n_noop()
1856 function __ngettext_noop() {
1857 _deprecated_function( __FUNCTION__, '2.8', '_n_noop()' );
1858 $args = func_get_args();
1859 return call_user_func_array('_n_noop', $args);
1864 * Retrieve all autoload options, or all options if no autoloaded ones exist.
1868 * @deprecated Use wp_load_alloptions())
1869 * @see wp_load_alloptions()
1871 * @return array List of all options.
1873 function get_alloptions() {
1874 _deprecated_function( __FUNCTION__, '3.0', 'wp_load_alloptions()' );
1875 return wp_load_alloptions();
1879 * Retrieve HTML content of attachment image with link.
1883 * @deprecated Use wp_get_attachment_link()
1884 * @see wp_get_attachment_link()
1886 * @param int $id Optional. Post ID.
1887 * @param bool $fullsize Optional, default is false. Whether to use full size image.
1888 * @param array $max_dims Optional. Max image dimensions.
1889 * @param bool $permalink Optional, default is false. Whether to include permalink to image.
1892 function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) {
1893 _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_link()' );
1895 $_post = & get_post($id);
1897 if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) )
1898 return __('Missing Attachment');
1901 $url = get_attachment_link($_post->ID);
1903 $post_title = esc_attr($_post->post_title);
1905 $innerHTML = get_attachment_innerHTML($_post->ID, $fullsize, $max_dims);
1906 return "<a href='$url' title='$post_title'>$innerHTML</a>";
1910 * Retrieve icon URL and Path.
1914 * @deprecated Use wp_get_attachment_image_src()
1915 * @see wp_get_attachment_image_src()
1917 * @param int $id Optional. Post ID.
1918 * @param bool $fullsize Optional, default to false. Whether to have full image.
1919 * @return array Icon URL and full path to file, respectively.
1921 function get_attachment_icon_src( $id = 0, $fullsize = false ) {
1922 _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_image_src()' );
1924 if ( !$post = & get_post($id) )
1927 $file = get_attached_file( $post->ID );
1929 if ( !$fullsize && $src = wp_get_attachment_thumb_url( $post->ID ) ) {
1930 // We have a thumbnail desired, specified and existing
1932 $src_file = basename($src);
1933 $class = 'attachmentthumb';
1934 } elseif ( wp_attachment_is_image( $post->ID ) ) {
1935 // We have an image without a thumbnail
1937 $src = wp_get_attachment_url( $post->ID );
1938 $src_file = & $file;
1939 $class = 'attachmentimage';
1940 } elseif ( $src = wp_mime_type_icon( $post->ID ) ) {
1941 // No thumb, no image. We'll look for a mime-related icon instead.
1943 $icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' );
1944 $src_file = $icon_dir . '/' . basename($src);
1947 if ( !isset($src) || !$src )
1950 return array($src, $src_file);
1954 * Retrieve HTML content of icon attachment image element.
1958 * @deprecated Use wp_get_attachment_image()
1959 * @see wp_get_attachment_image()
1961 * @param int $id Optional. Post ID.
1962 * @param bool $fullsize Optional, default to false. Whether to have full size image.
1963 * @param array $max_dims Optional. Dimensions of image.
1964 * @return string HTML content.
1966 function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) {
1967 _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_image()' );
1969 if ( !$post = & get_post($id) )
1972 if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) )
1975 list($src, $src_file) = $src;
1977 // Do we need to constrain the image?
1978 if ( ($max_dims = apply_filters('attachment_max_dims', $max_dims)) && file_exists($src_file) ) {
1980 $imagesize = getimagesize($src_file);
1982 if (($imagesize[0] > $max_dims[0]) || $imagesize[1] > $max_dims[1] ) {
1983 $actual_aspect = $imagesize[0] / $imagesize[1];
1984 $desired_aspect = $max_dims[0] / $max_dims[1];
1986 if ( $actual_aspect >= $desired_aspect ) {
1987 $height = $actual_aspect * $max_dims[0];
1988 $constraint = "width='{$max_dims[0]}' ";
1989 $post->iconsize = array($max_dims[0], $height);
1991 $width = $max_dims[1] / $actual_aspect;
1992 $constraint = "height='{$max_dims[1]}' ";
1993 $post->iconsize = array($width, $max_dims[1]);
1996 $post->iconsize = array($imagesize[0], $imagesize[1]);
2003 $post_title = esc_attr($post->post_title);
2005 $icon = "<img src='$src' title='$post_title' alt='$post_title' $constraint/>";
2007 return apply_filters( 'attachment_icon', $icon, $post->ID );
2011 * Retrieve HTML content of image element.
2015 * @deprecated Use wp_get_attachment_image()
2016 * @see wp_get_attachment_image()
2018 * @param int $id Optional. Post ID.
2019 * @param bool $fullsize Optional, default to false. Whether to have full size image.
2020 * @param array $max_dims Optional. Dimensions of image.
2023 function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) {
2024 _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_image()' );
2026 if ( !$post = & get_post($id) )
2029 if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims))
2033 $innerHTML = esc_attr($post->post_title);
2035 return apply_filters('attachment_innerHTML', $innerHTML, $post->ID);
2039 * Retrieve bookmark data based on ID.
2043 * @deprecated Use get_bookmark()
2044 * @see get_bookmark()
2046 * @param int $bookmark_id ID of link
2047 * @param string $output OBJECT, ARRAY_N, or ARRAY_A
2048 * @return object|array
2050 function get_link($bookmark_id, $output = OBJECT, $filter = 'raw') {
2051 _deprecated_function( __FUNCTION__, '2.1', 'get_bookmark()' );
2052 return get_bookmark($bookmark_id, $output, $filter);
2056 * Performs esc_url() for database or redirect usage.
2060 * @deprecated Use esc_url_raw()
2061 * @see esc_url_raw()
2063 * @param string $url The URL to be cleaned.
2064 * @param array $protocols An array of acceptable protocols.
2065 * @return string The cleaned URL.
2067 function sanitize_url( $url, $protocols = null ) {
2068 _deprecated_function( __FUNCTION__, '2.8', 'esc_url_raw()' );
2069 return esc_url_raw( $url, $protocols );
2073 * Checks and cleans a URL.
2075 * A number of characters are removed from the URL. If the URL is for displaying
2076 * (the default behaviour) amperstands are also replaced. The 'clean_url' filter
2077 * is applied to the returned cleaned URL.
2081 * @deprecated Use esc_url()
2082 * @see Alias for esc_url()
2084 * @param string $url The URL to be cleaned.
2085 * @param array $protocols Optional. An array of acceptable protocols.
2086 * @param string $context Optional. How the URL will be used. Default is 'display'.
2087 * @return string The cleaned $url after the 'clean_url' filter is applied.
2089 function clean_url( $url, $protocols = null, $context = 'display' ) {
2090 if ( $context == 'db' )
2091 _deprecated_function( 'clean_url( $context = \'db\' )', '3.0', 'esc_url_raw()' );
2093 _deprecated_function( __FUNCTION__, '3.0', 'esc_url()' );
2094 return esc_url( $url, $protocols, $context );
2098 * Escape single quotes, specialchar double quotes, and fix line endings.
2100 * The filter 'js_escape' is also applied by esc_js()
2104 * @deprecated Use esc_js()
2107 * @param string $text The text to be escaped.
2108 * @return string Escaped text.
2110 function js_escape( $text ) {
2111 _deprecated_function( __FUNCTION__, '2.8', 'esc_js()' );
2112 return esc_js( $text );
2116 * Escaping for HTML blocks.
2119 * @deprecated Use esc_html()
2122 function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
2123 _deprecated_function( __FUNCTION__, '2.8', 'esc_html()' );
2124 if ( func_num_args() > 1 ) { // Maintain backwards compat for people passing additional args
2125 $args = func_get_args();
2126 return call_user_func_array( '_wp_specialchars', $args );
2128 return esc_html( $string );
2134 * Escaping for HTML attributes.
2138 * @deprecated Use esc_attr()
2141 * @param string $text
2144 function attribute_escape( $text ) {
2145 _deprecated_function( __FUNCTION__, '2.8', 'esc_attr()' );
2146 return esc_attr( $text );
2150 * Register widget for sidebar with backwards compatibility.
2152 * Allows $name to be an array that accepts either three elements to grab the
2153 * first element and the third for the name or just uses the first element of
2154 * the array for the name.
2156 * Passes to {@link wp_register_sidebar_widget()} after argument list and
2157 * backwards compatibility is complete.
2161 * @deprecated Use wp_register_sidebar_widget()
2162 * @see wp_register_sidebar_widget()
2164 * @param string|int $name Widget ID.
2165 * @param callback $output_callback Run when widget is called.
2166 * @param string $classname Classname widget option.
2167 * @param mixed $params,... Widget parameters.
2169 function register_sidebar_widget($name, $output_callback, $classname = '') {
2170 _deprecated_function( __FUNCTION__, '2.8', 'wp_register_sidebar_widget()' );
2172 if ( is_array($name) ) {
2173 if ( count($name) == 3 )
2174 $name = sprintf($name[0], $name[2]);
2179 $id = sanitize_title($name);
2181 if ( !empty($classname) && is_string($classname) )
2182 $options['classname'] = $classname;
2183 $params = array_slice(func_get_args(), 2);
2184 $args = array($id, $name, $output_callback, $options);
2185 if ( !empty($params) )
2186 $args = array_merge($args, $params);
2188 call_user_func_array('wp_register_sidebar_widget', $args);
2192 * Alias of {@link wp_unregister_sidebar_widget()}.
2196 * @deprecated Use wp_unregister_sidebar_widget()
2197 * @see wp_unregister_sidebar_widget()
2199 * @param int|string $id Widget ID.
2201 function unregister_sidebar_widget($id) {
2202 _deprecated_function( __FUNCTION__, '2.8', 'wp_unregister_sidebar_widget()' );
2203 return wp_unregister_sidebar_widget($id);
2207 * Registers widget control callback for customizing options.
2209 * Allows $name to be an array that accepts either three elements to grab the
2210 * first element and the third for the name or just uses the first element of
2211 * the array for the name.
2213 * Passes to {@link wp_register_widget_control()} after the argument list has
2218 * @deprecated Use wp_register_widget_control()
2219 * @see wp_register_widget_control()
2221 * @param int|string $name Sidebar ID.
2222 * @param callback $control_callback Widget control callback to display and process form.
2223 * @param int $width Widget width.
2224 * @param int $height Widget height.
2226 function register_widget_control($name, $control_callback, $width = '', $height = '') {
2227 _deprecated_function( __FUNCTION__, '2.8', 'wp_register_widget_control()' );
2229 if ( is_array($name) ) {
2230 if ( count($name) == 3 )
2231 $name = sprintf($name[0], $name[2]);
2236 $id = sanitize_title($name);
2238 if ( !empty($width) )
2239 $options['width'] = $width;
2240 if ( !empty($height) )
2241 $options['height'] = $height;
2242 $params = array_slice(func_get_args(), 4);
2243 $args = array($id, $name, $control_callback, $options);
2244 if ( !empty($params) )
2245 $args = array_merge($args, $params);
2247 call_user_func_array('wp_register_widget_control', $args);
2251 * Alias of {@link wp_unregister_widget_control()}.
2255 * @deprecated Use wp_unregister_widget_control()
2256 * @see wp_unregister_widget_control()
2258 * @param int|string $id Widget ID.
2260 function unregister_widget_control($id) {
2261 _deprecated_function( __FUNCTION__, '2.8', 'wp_unregister_widget_control()' );
2262 return wp_unregister_widget_control($id);
2266 * Remove user meta data.
2270 * @deprecated Use delete_user_meta()
2271 * @see delete_user_meta()
2273 * @param int $user_id User ID.
2274 * @param string $meta_key Metadata key.
2275 * @param mixed $meta_value Metadata value.
2276 * @return bool True deletion completed and false if user_id is not a number.
2278 function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) {
2279 _deprecated_function( __FUNCTION__, '3.0', 'delete_user_meta()' );
2281 if ( !is_numeric( $user_id ) )
2283 $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
2285 if ( is_array($meta_value) || is_object($meta_value) )
2286 $meta_value = serialize($meta_value);
2287 $meta_value = trim( $meta_value );
2289 $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2291 if ( $cur && $cur->umeta_id )
2292 do_action( 'delete_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2294 if ( ! empty($meta_value) )
2295 $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) );
2297 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2299 wp_cache_delete($user_id, 'users');
2301 if ( $cur && $cur->umeta_id )
2302 do_action( 'deleted_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2308 * Retrieve user metadata.
2310 * If $user_id is not a number, then the function will fail over with a 'false'
2311 * boolean return value. Other returned values depend on whether there is only
2312 * one item to be returned, which be that single item type. If there is more
2313 * than one metadata value, then it will be list of metadata values.
2317 * @deprecated Use get_user_meta()
2318 * @see get_user_meta()
2320 * @param int $user_id User ID
2321 * @param string $meta_key Optional. Metadata key.
2324 function get_usermeta( $user_id, $meta_key = '' ) {
2325 _deprecated_function( __FUNCTION__, '3.0', 'get_user_meta()' );
2327 $user_id = (int) $user_id;
2332 if ( !empty($meta_key) ) {
2333 $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
2334 $user = wp_cache_get($user_id, 'users');
2335 // Check the cached user object
2336 if ( false !== $user && isset($user->$meta_key) )
2337 $metas = array($user->$meta_key);
2339 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2341 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d", $user_id) );
2344 if ( empty($metas) ) {
2345 if ( empty($meta_key) )
2351 $metas = array_map('maybe_unserialize', $metas);
2353 if ( count($metas) == 1 )
2360 * Update metadata of user.
2362 * There is no need to serialize values, they will be serialized if it is
2363 * needed. The metadata key can only be a string with underscores. All else will
2366 * Will remove the metadata, if the meta value is empty.
2370 * @deprecated Use update_user_meta()
2371 * @see update_user_meta()
2373 * @param int $user_id User ID
2374 * @param string $meta_key Metadata key.
2375 * @param mixed $meta_value Metadata value.
2376 * @return bool True on successful update, false on failure.
2378 function update_usermeta( $user_id, $meta_key, $meta_value ) {
2379 _deprecated_function( __FUNCTION__, '3.0', 'update_user_meta()' );
2381 if ( !is_numeric( $user_id ) )
2383 $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
2385 /** @todo Might need fix because usermeta data is assumed to be already escaped */
2386 if ( is_string($meta_value) )
2387 $meta_value = stripslashes($meta_value);
2388 $meta_value = maybe_serialize($meta_value);
2390 if (empty($meta_value)) {
2391 return delete_usermeta($user_id, $meta_key);
2394 $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2397 do_action( 'update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2400 $wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') );
2401 else if ( $cur->meta_value != $meta_value )
2402 $wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') );
2406 wp_cache_delete($user_id, 'users');
2409 do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value );
2411 do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2417 * Enable/disable automatic general feed link outputting.
2421 * @deprecated Use add_theme_support( 'automatic-feed-links' )
2423 * @param boolean $add Optional, default is true. Add or remove links. Defaults to true.
2425 function automatic_feed_links( $add = true ) {
2426 _deprecated_function( __FUNCTION__, '3.0', "add_theme_support( 'automatic-feed-links' )" );
2429 add_theme_support( 'automatic-feed-links' );
2431 remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+
2435 * Retrieve user data based on field.
2439 * @deprecated Use get_the_author_meta()
2440 * @see get_the_author_meta()
2442 function get_profile( $field, $user = false ) {
2443 _deprecated_function( __FUNCTION__, '3.0', 'get_the_author_meta()' );
2445 $user = get_user_by( 'login', $user );
2448 return get_the_author_meta( $field, $user );
2452 * Number of posts user has written.
2456 * @deprecated Use count_user_posts()
2457 * @see count_user_posts()
2459 function get_usernumposts( $userid ) {
2460 _deprecated_function( __FUNCTION__, '3.0', 'count_user_posts()' );
2461 return count_user_posts( $userid );
2465 * Callback used to change %uXXXX to &#YYY; syntax
2471 * @param array $matches Single Match
2472 * @return string An HTML entity
2474 function funky_javascript_callback($matches) {
2475 return "&#".base_convert($matches[1],16,10).";";
2479 * Fixes javascript bugs in browsers.
2481 * Converts unicode characters to HTML numbered entities.
2488 * @param string $text Text to be made safe.
2489 * @return string Fixed text.
2491 function funky_javascript_fix($text) {
2492 _deprecated_function( __FUNCTION__, '3.0' );
2493 // Fixes for browsers' javascript bugs
2494 global $is_macIE, $is_winIE;
2496 if ( $is_winIE || $is_macIE )
2497 $text = preg_replace_callback("/\%u([0-9A-F]{4,4})/",
2498 "funky_javascript_callback",
2505 * Generates and displays the RDF for the trackback information of current post.
2510 * @param int $deprecated Not used (Was $timezone = 0)
2512 function trackback_rdf($deprecated = '') {
2513 _deprecated_function( __FUNCTION__, '3.0' );
2518 * Checks that the taxonomy name exists.
2522 * @deprecated Use taxonomy_exists()
2523 * @see taxonomy_exists()
2525 * @param string $taxonomy Name of taxonomy object
2526 * @return bool Whether the taxonomy exists.
2528 function is_taxonomy( $taxonomy ) {
2529 _deprecated_function( __FUNCTION__, '3.0', 'taxonomy_exists()' );
2530 return taxonomy_exists( $taxonomy );
2534 * Check if Term exists.
2538 * @deprecated Use term_exists()
2539 * @see term_exists()
2541 * @param int|string $term The term to check
2542 * @param string $taxonomy The taxonomy name to use
2543 * @param int $parent ID of parent term under which to confine the exists search.
2544 * @return mixed Get the term id or Term Object, if exists.
2546 function is_term( $term, $taxonomy = '', $parent = 0 ) {
2547 _deprecated_function( __FUNCTION__, '3.0', 'term_exists()' );
2548 return term_exists( $term, $taxonomy, $parent );