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.
19 * @deprecated 1.5.1 Use get_post()
25 function get_postdata($postid) {
26 _deprecated_function( __FUNCTION__, '1.5.1', 'get_post()' );
28 $post = get_post($postid);
32 'Author_ID' => $post->post_author,
33 'Date' => $post->post_date,
34 'Content' => $post->post_content,
35 'Excerpt' => $post->post_excerpt,
36 'Title' => $post->post_title,
37 'Category' => $post->post_category,
38 'post_status' => $post->post_status,
39 'comment_status' => $post->comment_status,
40 'ping_status' => $post->ping_status,
41 'post_password' => $post->post_password,
42 'to_ping' => $post->to_ping,
43 'pinged' => $post->pinged,
44 'post_type' => $post->post_type,
45 'post_name' => $post->post_name
52 * Sets up the WordPress Loop.
54 * Use The Loop instead.
56 * @link https://codex.wordpress.org/The_Loop
64 _deprecated_function( __FUNCTION__, '1.5', __('new WordPress Loop') );
66 // Since the old style loop is being used, advance the query iterator here.
67 $wp_query->next_post();
69 setup_postdata( get_post() );
73 * Return or Print Category ID.
76 * @deprecated 0.71 Use get_the_category()
77 * @see get_the_category()
82 function the_category_ID($echo = true) {
83 _deprecated_function( __FUNCTION__, '0.71', 'get_the_category()' );
85 // Grab the first cat in the list.
86 $categories = get_the_category();
87 $cat = $categories[0]->term_id;
96 * Print category with optional text before and after.
99 * @deprecated 0.71 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.
125 * @deprecated 2.0.0 Use previous_post_link()
126 * @see previous_post_link()
128 * @param string $format
129 * @param string $previous
130 * @param string $title
131 * @param string $in_same_cat
132 * @param int $limitprev
133 * @param string $excluded_categories
135 function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') {
137 _deprecated_function( __FUNCTION__, '2.0', 'previous_post_link()' );
139 if ( empty($in_same_cat) || 'no' == $in_same_cat )
140 $in_same_cat = false;
144 $post = get_previous_post($in_same_cat, $excluded_categories);
149 $string = '<a href="'.get_permalink($post->ID).'">'.$previous;
150 if ( 'yes' == $title )
151 $string .= apply_filters('the_title', $post->post_title, $post->ID);
153 $format = str_replace('%', $string, $format);
158 * Prints link to the next post.
161 * @deprecated 2.0.0 Use next_post_link()
162 * @see next_post_link()
164 * @param string $format
165 * @param string $next
166 * @param string $title
167 * @param string $in_same_cat
168 * @param int $limitnext
169 * @param string $excluded_categories
171 function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') {
172 _deprecated_function( __FUNCTION__, '2.0', 'next_post_link()' );
174 if ( empty($in_same_cat) || 'no' == $in_same_cat )
175 $in_same_cat = false;
179 $post = get_next_post($in_same_cat, $excluded_categories);
184 $string = '<a href="'.get_permalink($post->ID).'">'.$next;
185 if ( 'yes' == $title )
186 $string .= apply_filters('the_title', $post->post_title, $post->ID);
188 $format = str_replace('%', $string, $format);
193 * Whether user can create a post.
196 * @deprecated 2.0.0 Use current_user_can()
197 * @see current_user_can()
199 * @param int $user_id
200 * @param int $blog_id Not Used
201 * @param int $category_id Not Used
204 function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') {
205 _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
207 $author_data = get_userdata($user_id);
208 return ($author_data->user_level > 1);
212 * Whether user can create a post.
215 * @deprecated 2.0.0 Use current_user_can()
216 * @see current_user_can()
218 * @param int $user_id
219 * @param int $blog_id Not Used
220 * @param int $category_id Not Used
223 function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') {
224 _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
226 $author_data = get_userdata($user_id);
227 return ($author_data->user_level >= 1);
231 * Whether user can edit a post.
234 * @deprecated 2.0.0 Use current_user_can()
235 * @see current_user_can()
237 * @param int $user_id
238 * @param int $post_id
239 * @param int $blog_id Not Used
242 function user_can_edit_post($user_id, $post_id, $blog_id = 1) {
243 _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
245 $author_data = get_userdata($user_id);
246 $post = get_post($post_id);
247 $post_author_data = get_userdata($post->post_author);
249 if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2))
250 || ($author_data->user_level > $post_author_data->user_level)
251 || ($author_data->user_level >= 10) ) {
259 * Whether user can delete a post.
262 * @deprecated 2.0.0 Use current_user_can()
263 * @see current_user_can()
265 * @param int $user_id
266 * @param int $post_id
267 * @param int $blog_id Not Used
270 function user_can_delete_post($user_id, $post_id, $blog_id = 1) {
271 _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
273 // right now if one can edit, one can delete
274 return user_can_edit_post($user_id, $post_id, $blog_id);
278 * Whether user can set new posts' dates.
281 * @deprecated 2.0.0 Use current_user_can()
282 * @see current_user_can()
284 * @param int $user_id
285 * @param int $blog_id Not Used
286 * @param int $category_id Not Used
289 function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') {
290 _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
292 $author_data = get_userdata($user_id);
293 return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id));
297 * Whether user can delete a post.
300 * @deprecated 2.0.0 Use current_user_can()
301 * @see current_user_can()
303 * @param int $user_id
304 * @param int $post_id
305 * @param int $blog_id Not Used
306 * @return bool returns true if $user_id can edit $post_id's date
308 function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) {
309 _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
311 $author_data = get_userdata($user_id);
312 return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id));
316 * Whether user can delete a post.
319 * @deprecated 2.0.0 Use current_user_can()
320 * @see current_user_can()
322 * @param int $user_id
323 * @param int $post_id
324 * @param int $blog_id Not Used
325 * @return bool returns true if $user_id can edit $post_id's comments
327 function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) {
328 _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
330 // right now if one can edit a post, one can edit comments made on it
331 return user_can_edit_post($user_id, $post_id, $blog_id);
335 * Whether user can delete a post.
338 * @deprecated 2.0.0 Use current_user_can()
339 * @see current_user_can()
341 * @param int $user_id
342 * @param int $post_id
343 * @param int $blog_id Not Used
344 * @return bool returns true if $user_id can delete $post_id's comments
346 function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) {
347 _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
349 // right now if one can edit comments, one can delete comments
350 return user_can_edit_post_comments($user_id, $post_id, $blog_id);
354 * Can user can edit other user.
357 * @deprecated 2.0.0 Use current_user_can()
358 * @see current_user_can()
360 * @param int $user_id
361 * @param int $other_user
364 function user_can_edit_user($user_id, $other_user) {
365 _deprecated_function( __FUNCTION__, '2.0', 'current_user_can()' );
367 $user = get_userdata($user_id);
368 $other = get_userdata($other_user);
369 if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID )
376 * Gets the links associated with category $cat_name.
379 * @deprecated 2.1.0 Use get_bookmarks()
380 * @see get_bookmarks()
382 * @param string $cat_name Optional. The category name to use. If no match is found uses all.
383 * @param string $before Optional. The html to output before the link.
384 * @param string $after Optional. The html to output after the link.
385 * @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.
386 * @param bool $show_images Optional. Whether to show images (if defined).
387 * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', 'description' or 'rating'. Or maybe owner.
388 * 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
390 * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined.
391 * @param bool $show_rating Optional. Show rating stars/chars.
392 * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown.
393 * @param int $show_updated Optional. Whether to show last updated timestamp
395 function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = true, $orderby = 'id',
396 $show_description = true, $show_rating = false,
397 $limit = -1, $show_updated = 0) {
398 _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' );
401 $cat = get_term_by('name', $cat_name, 'link_category');
403 $cat_id = $cat->term_id;
405 get_links($cat_id, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated);
409 * Gets the links associated with the named category.
412 * @deprecated 2.1.0 Use wp_list_bookmarks()
413 * @see wp_list_bookmarks()
415 * @param string $category The category to use.
416 * @param string $args
417 * @return string|null
419 function wp_get_linksbyname($category, $args = '') {
420 _deprecated_function(__FUNCTION__, '2.1', 'wp_list_bookmarks()');
426 'category_after' => '',
427 'category_before' => '',
428 'category_name' => $category,
429 'show_description' => 1,
433 $r = wp_parse_args( $args, $defaults );
435 return wp_list_bookmarks($r);
439 * Gets an array of link objects associated with category $cat_name.
441 * $links = get_linkobjectsbyname( 'fred' );
442 * foreach ( $links as $link ) {
443 * echo '<li>' . $link->link_name . '</li>';
447 * @deprecated 2.1.0 Use get_bookmarks()
448 * @see get_bookmarks()
450 * @param string $cat_name The category name to use. If no match is found uses all.
451 * @param string $orderby The order to output the links. E.g. 'id', 'name', 'url', 'description', or 'rating'.
452 * Or maybe owner. If you start the name with an underscore the order will be reversed. You can also
453 * specify 'rand' as the order which will return links in a random order.
454 * @param int $limit Limit to X entries. If not specified, all entries are shown.
457 function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) {
458 _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' );
461 $cat = get_term_by('name', $cat_name, 'link_category');
463 $cat_id = $cat->term_id;
465 return get_linkobjects($cat_id, $orderby, $limit);
469 * Gets an array of link objects associated with category n.
473 * $links = get_linkobjects(1);
475 * foreach ($links as $link) {
476 * echo '<li>'.$link->link_name.'<br />'.$link->link_description.'</li>';
497 * @deprecated 2.1.0 Use get_bookmarks()
498 * @see get_bookmarks()
500 * @param int $category The category to use. If no category supplied uses all
501 * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url',
502 * 'description', or 'rating'. Or maybe owner. If you start the name with an
503 * underscore the order will be reversed. You can also specify 'rand' as the
504 * order which will return links in a random order.
505 * @param int $limit Limit to X entries. If not specified, all entries are shown.
508 function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) {
509 _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' );
511 $links = get_bookmarks( array( 'category' => $category, 'orderby' => $orderby, 'limit' => $limit ) ) ;
513 $links_array = array();
514 foreach ($links as $link)
515 $links_array[] = $link;
521 * Gets the links associated with category 'cat_name' and display rating stars/chars.
524 * @deprecated 2.1.0 Use get_bookmarks()
525 * @see get_bookmarks()
527 * @param string $cat_name The category name to use. If no match is found uses all
528 * @param string $before The html to output before the link
529 * @param string $after The html to output after the link
530 * @param string $between The html to output between the link/image and its description. Not used if no image or show_images is true
531 * @param bool $show_images Whether to show images (if defined).
532 * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url',
533 * 'description', or 'rating'. Or maybe owner. If you start the name with an
534 * underscore the order will be reversed. You can also specify 'rand' as the
535 * order which will return links in a random order.
536 * @param bool $show_description Whether to show the description if show_images=false/not defined
537 * @param int $limit Limit to X entries. If not specified, all entries are shown.
538 * @param int $show_updated Whether to show last updated timestamp
540 function get_linksbyname_withrating($cat_name = "noname", $before = '', $after = '<br />', $between = " ",
541 $show_images = true, $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) {
542 _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' );
544 get_linksbyname($cat_name, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated);
548 * Gets the links associated with category n and display rating stars/chars.
551 * @deprecated 2.1.0 Use get_bookmarks()
552 * @see get_bookmarks()
554 * @param int $category The category to use. If no category supplied uses all
555 * @param string $before The html to output before the link
556 * @param string $after The html to output after the link
557 * @param string $between The html to output between the link/image and its description. Not used if no image or show_images == true
558 * @param bool $show_images Whether to show images (if defined).
559 * @param string $orderby The order to output the links. E.g. 'id', 'name', 'url',
560 * 'description', or 'rating'. Or maybe owner. If you start the name with an
561 * underscore the order will be reversed. You can also specify 'rand' as the
562 * order which will return links in a random order.
563 * @param bool $show_description Whether to show the description if show_images=false/not defined.
564 * @param int $limit Limit to X entries. If not specified, all entries are shown.
565 * @param int $show_updated Whether to show last updated timestamp
567 function get_links_withrating($category = -1, $before = '', $after = '<br />', $between = " ", $show_images = true,
568 $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) {
569 _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' );
571 get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated);
575 * Gets the auto_toggle setting.
580 * @param int $id The category to get. If no category supplied uses 0
581 * @return int Only returns 0.
583 function get_autotoggle($id = 0) {
584 _deprecated_function( __FUNCTION__, '2.1' );
592 * @deprecated 2.1.0 Use wp_list_categories()
593 * @see wp_list_categories()
595 * @param int $optionall
597 * @param string $sort_column
598 * @param string $sort_order
599 * @param string $file
601 * @param int $optiondates
602 * @param int $optioncount
603 * @param int $hide_empty
604 * @param int $use_desc_for_title
605 * @param bool $children
606 * @param int $child_of
607 * @param int $categories
608 * @param int $recurse
609 * @param string $feed
610 * @param string $feed_image
611 * @param string $exclude
612 * @param bool $hierarchical
615 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0,
616 $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0,
617 $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) {
618 _deprecated_function( __FUNCTION__, '2.1', 'wp_list_categories()' );
620 $query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children',
621 'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical');
622 return wp_list_cats($query);
629 * @deprecated 2.1.0 Use wp_list_categories()
630 * @see wp_list_categories()
632 * @param string|array $args
633 * @return false|null|string
635 function wp_list_cats($args = '') {
636 _deprecated_function( __FUNCTION__, '2.1', 'wp_list_categories()' );
638 $r = wp_parse_args( $args );
641 if ( isset($r['optionall']) && isset($r['all']))
642 $r['show_option_all'] = $r['all'];
643 if ( isset($r['sort_column']) )
644 $r['orderby'] = $r['sort_column'];
645 if ( isset($r['sort_order']) )
646 $r['order'] = $r['sort_order'];
647 if ( isset($r['optiondates']) )
648 $r['show_last_update'] = $r['optiondates'];
649 if ( isset($r['optioncount']) )
650 $r['show_count'] = $r['optioncount'];
651 if ( isset($r['list']) )
652 $r['style'] = $r['list'] ? 'list' : 'break';
655 return wp_list_categories($r);
659 * Deprecated method for generating a drop-down of categories.
662 * @deprecated 2.1.0 Use wp_dropdown_categories()
663 * @see wp_dropdown_categories()
665 * @param int $optionall
667 * @param string $orderby
668 * @param string $order
669 * @param int $show_last_update
670 * @param int $show_count
671 * @param int $hide_empty
672 * @param bool $optionnone
673 * @param int $selected
674 * @param int $exclude
677 function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc',
678 $show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = false,
679 $selected = 0, $exclude = 0) {
680 _deprecated_function( __FUNCTION__, '2.1', 'wp_dropdown_categories()' );
682 $show_option_all = '';
684 $show_option_all = $all;
686 $show_option_none = '';
688 $show_option_none = __('None');
690 $vars = compact('show_option_all', 'show_option_none', 'orderby', 'order',
691 'show_last_update', 'show_count', 'hide_empty', 'selected', 'exclude');
692 $query = add_query_arg($vars, '');
693 return wp_dropdown_categories($query);
700 * @deprecated 2.1.0 Use wp_list_authors()
701 * @see wp_list_authors()
703 * @param bool $optioncount
704 * @param bool $exclude_admin
705 * @param bool $show_fullname
706 * @param bool $hide_empty
707 * @param string $feed
708 * @param string $feed_image
709 * @return null|string
711 function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') {
712 _deprecated_function( __FUNCTION__, '2.1', 'wp_list_authors()' );
714 $args = compact('optioncount', 'exclude_admin', 'show_fullname', 'hide_empty', 'feed', 'feed_image');
715 return wp_list_authors($args);
719 * Retrieves a list of post categories.
722 * @deprecated 2.1.0 Use wp_get_post_categories()
723 * @see wp_get_post_categories()
725 * @param int $blogid Not Used
726 * @param int $post_ID
729 function wp_get_post_cats($blogid = '1', $post_ID = 0) {
730 _deprecated_function( __FUNCTION__, '2.1', 'wp_get_post_categories()' );
731 return wp_get_post_categories($post_ID);
735 * Sets the categories that the post id belongs to.
739 * @deprecated Use wp_set_post_categories()
740 * @see wp_set_post_categories()
742 * @param int $blogid Not used
743 * @param int $post_ID
744 * @param array $post_categories
747 function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) {
748 _deprecated_function( __FUNCTION__, '2.1', 'wp_set_post_categories()' );
749 return wp_set_post_categories($post_ID, $post_categories);
753 * Retrieves a list of archives.
756 * @deprecated 2.1.0 Use wp_get_archives()
757 * @see wp_get_archives()
759 * @param string $type
760 * @param string $limit
761 * @param string $format
762 * @param string $before
763 * @param string $after
764 * @param bool $show_post_count
765 * @return string|null
767 function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) {
768 _deprecated_function( __FUNCTION__, '2.1', 'wp_get_archives()' );
769 $args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count');
770 return wp_get_archives($args);
774 * Returns or Prints link to the author's posts.
777 * @deprecated 2.1.0 Use get_author_posts_url()
778 * @see get_author_posts_url()
781 * @param int $author_id
782 * @param string $author_nicename Optional.
783 * @return string|null
785 function get_author_link($echo, $author_id, $author_nicename = '') {
786 _deprecated_function( __FUNCTION__, '2.1', 'get_author_posts_url()' );
788 $link = get_author_posts_url($author_id, $author_nicename);
796 * Print list of pages based on arguments.
799 * @deprecated 2.1.0 Use wp_link_pages()
800 * @see wp_link_pages()
802 * @param string $before
803 * @param string $after
804 * @param string $next_or_number
805 * @param string $nextpagelink
806 * @param string $previouspagelink
807 * @param string $pagelink
808 * @param string $more_file
811 function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page',
812 $pagelink='%', $more_file='') {
813 _deprecated_function( __FUNCTION__, '2.1', 'wp_link_pages()' );
815 $args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file');
816 return wp_link_pages($args);
820 * Get value based on option.
823 * @deprecated 2.1.0 Use get_option()
826 * @param string $option
829 function get_settings($option) {
830 _deprecated_function( __FUNCTION__, '2.1', 'get_option()' );
832 return get_option($option);
836 * Print the permalink of the current post in the loop.
839 * @deprecated 1.2.0 Use the_permalink()
840 * @see the_permalink()
842 function permalink_link() {
843 _deprecated_function( __FUNCTION__, '1.2', 'the_permalink()' );
848 * Print the permalink to the RSS feed.
851 * @deprecated 2.3.0 Use the_permalink_rss()
852 * @see the_permalink_rss()
854 * @param string $deprecated
856 function permalink_single_rss($deprecated = '') {
857 _deprecated_function( __FUNCTION__, '2.3', 'the_permalink_rss()' );
862 * Gets the links associated with category.
865 * @deprecated 2.1.0 Use wp_list_bookmarks()
866 * @see wp_list_bookmarks()
868 * @param string $args a query string
869 * @return null|string
871 function wp_get_links($args = '') {
872 _deprecated_function( __FUNCTION__, '2.1', 'wp_list_bookmarks()' );
874 if ( strpos( $args, '=' ) === false ) {
876 $args = add_query_arg( 'category', $cat_id, $args );
888 'show_description' => true,
889 'show_images' => true,
890 'show_rating' => false,
891 'show_updated' => true,
895 $r = wp_parse_args( $args, $defaults );
897 return wp_list_bookmarks($r);
901 * Gets the links associated with category by id.
904 * @deprecated 2.1.0 Use get_bookmarks()
905 * @see get_bookmarks()
907 * @param int $category The category to use. If no category supplied uses all
908 * @param string $before the html to output before the link
909 * @param string $after the html to output after the link
910 * @param string $between the html to output between the link/image and its description.
911 * Not used if no image or show_images == true
912 * @param bool $show_images whether to show images (if defined).
913 * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url',
914 * 'description', or 'rating'. Or maybe owner. If you start the name with an
915 * underscore the order will be reversed. You can also specify 'rand' as the order
916 * which will return links in a random order.
917 * @param bool $show_description whether to show the description if show_images=false/not defined.
918 * @param bool $show_rating show rating stars/chars
919 * @param int $limit Limit to X entries. If not specified, all entries are shown.
920 * @param int $show_updated whether to show last updated timestamp
921 * @param bool $echo whether to echo the results, or return them instead
922 * @return null|string
924 function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name',
925 $show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $echo = true) {
926 _deprecated_function( __FUNCTION__, '2.1', 'get_bookmarks()' );
929 if ( substr($orderby, 0, 1) == '_' ) {
931 $orderby = substr($orderby, 1);
934 if ( $category == -1 ) //get_bookmarks uses '' to signify all categories
937 $results = get_bookmarks(array('category' => $category, 'orderby' => $orderby, 'order' => $order, 'show_updated' => $show_updated, 'limit' => $limit));
944 foreach ( (array) $results as $row ) {
945 if ( !isset($row->recently_updated) )
946 $row->recently_updated = false;
948 if ( $show_updated && $row->recently_updated )
949 $output .= get_option('links_recently_updated_prepend');
951 if ( !empty($row->link_url) )
952 $the_link = esc_url($row->link_url);
953 $rel = $row->link_rel;
955 $rel = ' rel="' . $rel . '"';
957 $desc = esc_attr(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display'));
958 $name = esc_attr(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display'));
962 if (substr($row->link_updated_f, 0, 2) != '00')
963 $title .= ' ('.__('Last updated') . ' ' . date(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')';
966 $title = ' title="' . $title . '"';
968 $alt = ' alt="' . $name . '"';
970 $target = $row->link_target;
972 $target = ' target="' . $target . '"';
974 $output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>';
976 if ( $row->link_image != null && $show_images ) {
977 if ( strpos($row->link_image, 'http') !== false )
978 $output .= "<img src=\"$row->link_image\" $alt $title />";
979 else // If it's a relative path
980 $output .= "<img src=\"" . get_option('siteurl') . "$row->link_image\" $alt $title />";
987 if ( $show_updated && $row->recently_updated )
988 $output .= get_option('links_recently_updated_append');
990 if ( $show_description && '' != $desc )
991 $output .= $between . $desc;
994 $output .= $between . get_linkrating($row);
997 $output .= "$after\n";
1006 * Output entire list of links by category.
1008 * Output a list of all links, listed by category, using the settings in
1009 * $wpdb->linkcategories and output it as a nested HTML unordered list.
1012 * @deprecated 2.1.0 Use wp_list_bookmarks()
1013 * @see wp_list_bookmarks()
1015 * @param string $order Sort link categories by 'name' or 'id'
1017 function get_links_list($order = 'name') {
1018 _deprecated_function( __FUNCTION__, '2.1', 'wp_list_bookmarks()' );
1020 $order = strtolower($order);
1022 // Handle link category sorting
1024 if ( '_' == substr($order,0,1) ) {
1025 $direction = 'DESC';
1026 $order = substr($order,1);
1029 if ( !isset($direction) )
1032 $cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0));
1034 // Display each category
1036 foreach ( (array) $cats as $cat ) {
1037 // Handle each category.
1039 // Display the category name
1040 echo ' <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name ) . "</h2>\n\t<ul>\n";
1041 // Call get_links() with all the appropriate params
1042 get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false);
1044 // Close the last category
1045 echo "\n\t</ul>\n</li>\n";
1051 * Show the link to the links popup and the number of links.
1056 * @param string $text the text of the link
1057 * @param int $width the width of the popup window
1058 * @param int $height the height of the popup window
1059 * @param string $file the page to open in the popup window
1060 * @param bool $count the number of links in the db
1062 function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) {
1063 _deprecated_function( __FUNCTION__, '2.1' );
1068 * @deprecated 2.1.0 Use sanitize_bookmark_field()
1069 * @see sanitize_bookmark_field()
1071 * @param object $link
1074 function get_linkrating($link) {
1075 _deprecated_function( __FUNCTION__, '2.1', 'sanitize_bookmark_field()' );
1076 return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display');
1080 * Gets the name of category by id.
1083 * @deprecated 2.1.0 Use get_category()
1084 * @see get_category()
1086 * @param int $id The category to get. If no category supplied uses 0
1089 function get_linkcatname($id = 0) {
1090 _deprecated_function( __FUNCTION__, '2.1', 'get_category()' );
1097 $cats = wp_get_link_cats($id);
1099 if ( empty($cats) || ! is_array($cats) )
1102 $cat_id = (int) $cats[0]; // Take the first cat.
1104 $cat = get_category($cat_id);
1109 * Print RSS comment feed link.
1112 * @deprecated 2.5.0 Use post_comments_feed_link()
1113 * @see post_comments_feed_link()
1115 * @param string $link_text
1117 function comments_rss_link($link_text = 'Comments RSS') {
1118 _deprecated_function( __FUNCTION__, '2.5', 'post_comments_feed_link()' );
1119 post_comments_feed_link($link_text);
1123 * Print/Return link to category RSS2 feed.
1126 * @deprecated 2.5.0 Use get_category_feed_link()
1127 * @see get_category_feed_link()
1130 * @param int $cat_ID
1133 function get_category_rss_link($echo = false, $cat_ID = 1) {
1134 _deprecated_function( __FUNCTION__, '2.5', 'get_category_feed_link()' );
1136 $link = get_category_feed_link($cat_ID, 'rss2');
1144 * Print/Return link to author RSS feed.
1147 * @deprecated 2.5.0 Use get_author_feed_link()
1148 * @see get_author_feed_link()
1151 * @param int $author_id
1154 function get_author_rss_link($echo = false, $author_id = 1) {
1155 _deprecated_function( __FUNCTION__, '2.5', 'get_author_feed_link()' );
1157 $link = get_author_feed_link($author_id);
1164 * Return link to the post RSS feed.
1167 * @deprecated 2.2.0 Use get_post_comments_feed_link()
1168 * @see get_post_comments_feed_link()
1172 function comments_rss() {
1173 _deprecated_function( __FUNCTION__, '2.2', 'get_post_comments_feed_link()' );
1174 return esc_url( get_post_comments_feed_link() );
1178 * An alias of wp_create_user().
1181 * @deprecated 2.0.0 Use wp_create_user()
1182 * @see wp_create_user()
1184 * @param string $username The user's username.
1185 * @param string $password The user's password.
1186 * @param string $email The user's email.
1187 * @return int The new user's ID.
1189 function create_user($username, $password, $email) {
1190 _deprecated_function( __FUNCTION__, '2.0', 'wp_create_user()' );
1191 return wp_create_user($username, $password, $email);
1199 function gzip_compression() {
1200 _deprecated_function( __FUNCTION__, '2.5' );
1205 * Retrieve an array of comment data about comment $comment_ID.
1208 * @deprecated 2.7.0 Use get_comment()
1209 * @see get_comment()
1211 * @param int $comment_ID The ID of the comment
1212 * @param int $no_cache Whether to use the cache (cast to bool)
1213 * @param bool $include_unapproved Whether to include unapproved comments
1214 * @return array The comment data
1216 function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) {
1217 _deprecated_function( __FUNCTION__, '2.7', 'get_comment()' );
1218 return get_comment($comment_ID, ARRAY_A);
1222 * Retrieve the category name by the category ID.
1225 * @deprecated 2.8.0 Use get_cat_name()
1226 * @see get_cat_name()
1228 * @param int $cat_ID Category ID
1229 * @return string category name
1231 function get_catname( $cat_ID ) {
1232 _deprecated_function( __FUNCTION__, '2.8', 'get_cat_name()' );
1233 return get_cat_name( $cat_ID );
1237 * Retrieve category children list separated before and after the term IDs.
1240 * @deprecated 2.8.0 Use get_term_children()
1241 * @see get_term_children()
1243 * @param int $id Category ID to retrieve children.
1244 * @param string $before Optional. Prepend before category term ID.
1245 * @param string $after Optional, default is empty string. Append after category term ID.
1246 * @param array $visited Optional. Category Term IDs that have already been added.
1249 function get_category_children( $id, $before = '/', $after = '', $visited = array() ) {
1250 _deprecated_function( __FUNCTION__, '2.8', 'get_term_children()' );
1255 /** TODO: consult hierarchy */
1256 $cat_ids = get_all_category_ids();
1257 foreach ( (array) $cat_ids as $cat_id ) {
1258 if ( $cat_id == $id )
1261 $category = get_category( $cat_id );
1262 if ( is_wp_error( $category ) )
1264 if ( $category->parent == $id && !in_array( $category->term_id, $visited ) ) {
1265 $visited[] = $category->term_id;
1266 $chain .= $before.$category->term_id.$after;
1267 $chain .= get_category_children( $category->term_id, $before, $after );
1274 * Retrieves all category IDs.
1277 * @deprecated 4.0.0 Use get_terms()
1280 * @link https://codex.wordpress.org/Function_Reference/get_all_category_ids
1282 * @return object List of all of the category IDs.
1284 function get_all_category_ids() {
1285 _deprecated_function( __FUNCTION__, '4.0', 'get_terms()' );
1287 if ( ! $cat_ids = wp_cache_get( 'all_category_ids', 'category' ) ) {
1288 $cat_ids = get_terms( 'category', array('fields' => 'ids', 'get' => 'all') );
1289 wp_cache_add( 'all_category_ids', $cat_ids, 'category' );
1296 * Retrieve the description of the author of the current post.
1299 * @deprecated 2.8.0 Use get_the_author_meta()
1300 * @see get_the_author_meta()
1302 * @return string The author's description.
1304 function get_the_author_description() {
1305 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'description\')' );
1306 return get_the_author_meta('description');
1310 * Display the description of the author of the current post.
1313 * @deprecated 2.8.0 Use the_author_meta()
1314 * @see the_author_meta()
1316 function the_author_description() {
1317 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'description\')' );
1318 the_author_meta('description');
1322 * Retrieve the login name of the author of the current post.
1325 * @deprecated 2.8.0 Use get_the_author_meta()
1326 * @see get_the_author_meta()
1328 * @return string The author's login name (username).
1330 function get_the_author_login() {
1331 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'login\')' );
1332 return get_the_author_meta('login');
1336 * Display the login name of the author of the current post.
1339 * @deprecated 2.8.0 Use the_author_meta()
1340 * @see the_author_meta()
1342 function the_author_login() {
1343 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'login\')' );
1344 the_author_meta('login');
1348 * Retrieve the first name of the author of the current post.
1351 * @deprecated 2.8.0 Use get_the_author_meta()
1352 * @see get_the_author_meta()
1354 * @return string The author's first name.
1356 function get_the_author_firstname() {
1357 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'first_name\')' );
1358 return get_the_author_meta('first_name');
1362 * Display the first name of the author of the current post.
1365 * @deprecated 2.8.0 Use the_author_meta()
1366 * @see the_author_meta()
1368 function the_author_firstname() {
1369 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'first_name\')' );
1370 the_author_meta('first_name');
1374 * Retrieve the last name of the author of the current post.
1377 * @deprecated 2.8.0 Use get_the_author_meta()
1378 * @see get_the_author_meta()
1380 * @return string The author's last name.
1382 function get_the_author_lastname() {
1383 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'last_name\')' );
1384 return get_the_author_meta('last_name');
1388 * Display the last name of the author of the current post.
1391 * @deprecated 2.8.0 Use the_author_meta()
1392 * @see the_author_meta()
1394 function the_author_lastname() {
1395 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'last_name\')' );
1396 the_author_meta('last_name');
1400 * Retrieve the nickname of the author of the current post.
1403 * @deprecated 2.8.0 Use get_the_author_meta()
1404 * @see get_the_author_meta()
1406 * @return string The author's nickname.
1408 function get_the_author_nickname() {
1409 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'nickname\')' );
1410 return get_the_author_meta('nickname');
1414 * Display the nickname of the author of the current post.
1417 * @deprecated 2.8.0 Use the_author_meta()
1418 * @see the_author_meta()
1420 function the_author_nickname() {
1421 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'nickname\')' );
1422 the_author_meta('nickname');
1426 * Retrieve the email of the author of the current post.
1429 * @deprecated 2.8.0 Use get_the_author_meta()
1430 * @see get_the_author_meta()
1432 * @return string The author's username.
1434 function get_the_author_email() {
1435 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'email\')' );
1436 return get_the_author_meta('email');
1440 * Display the email of the author of the current post.
1443 * @deprecated 2.8.0 Use the_author_meta()
1444 * @see the_author_meta()
1446 function the_author_email() {
1447 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'email\')' );
1448 the_author_meta('email');
1452 * Retrieve the ICQ number of the author of the current post.
1455 * @deprecated 2.8.0 Use get_the_author_meta()
1456 * @see get_the_author_meta()
1458 * @return string The author's ICQ number.
1460 function get_the_author_icq() {
1461 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'icq\')' );
1462 return get_the_author_meta('icq');
1466 * Display the ICQ number of the author of the current post.
1469 * @deprecated 2.8.0 Use the_author_meta()
1470 * @see the_author_meta()
1472 function the_author_icq() {
1473 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'icq\')' );
1474 the_author_meta('icq');
1478 * Retrieve the Yahoo! IM name of the author of the current post.
1481 * @deprecated 2.8.0 Use get_the_author_meta()
1482 * @see get_the_author_meta()
1484 * @return string The author's Yahoo! IM name.
1486 function get_the_author_yim() {
1487 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'yim\')' );
1488 return get_the_author_meta('yim');
1492 * Display the Yahoo! IM name of the author of the current post.
1495 * @deprecated 2.8.0 Use the_author_meta()
1496 * @see the_author_meta()
1498 function the_author_yim() {
1499 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'yim\')' );
1500 the_author_meta('yim');
1504 * Retrieve the MSN address of the author of the current post.
1507 * @deprecated 2.8.0 Use get_the_author_meta()
1508 * @see get_the_author_meta()
1510 * @return string The author's MSN address.
1512 function get_the_author_msn() {
1513 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'msn\')' );
1514 return get_the_author_meta('msn');
1518 * Display the MSN address of the author of the current post.
1521 * @deprecated 2.8.0 Use the_author_meta()
1522 * @see the_author_meta()
1524 function the_author_msn() {
1525 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'msn\')' );
1526 the_author_meta('msn');
1530 * Retrieve the AIM address of the author of the current post.
1533 * @deprecated 2.8.0 Use get_the_author_meta()
1534 * @see get_the_author_meta()
1536 * @return string The author's AIM address.
1538 function get_the_author_aim() {
1539 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'aim\')' );
1540 return get_the_author_meta('aim');
1544 * Display the AIM address of the author of the current post.
1547 * @deprecated 2.8.0 Use the_author_meta('aim')
1548 * @see the_author_meta()
1550 function the_author_aim() {
1551 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'aim\')' );
1552 the_author_meta('aim');
1556 * Retrieve the specified author's preferred display name.
1559 * @deprecated 2.8.0 Use get_the_author_meta()
1560 * @see get_the_author_meta()
1562 * @param int $auth_id The ID of the author.
1563 * @return string The author's display name.
1565 function get_author_name( $auth_id = false ) {
1566 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'display_name\')' );
1567 return get_the_author_meta('display_name', $auth_id);
1571 * Retrieve the URL to the home page of the author of the current post.
1574 * @deprecated 2.8.0 Use get_the_author_meta()
1575 * @see get_the_author_meta()
1577 * @return string The URL to the author's page.
1579 function get_the_author_url() {
1580 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'url\')' );
1581 return get_the_author_meta('url');
1585 * Display the URL to the home page of the author of the current post.
1588 * @deprecated 2.8.0 Use the_author_meta()
1589 * @see the_author_meta()
1591 function the_author_url() {
1592 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'url\')' );
1593 the_author_meta('url');
1597 * Retrieve the ID of the author of the current post.
1600 * @deprecated 2.8.0 Use get_the_author_meta()
1601 * @see get_the_author_meta()
1603 * @return string|int The author's ID.
1605 function get_the_author_ID() {
1606 _deprecated_function( __FUNCTION__, '2.8', 'get_the_author_meta(\'ID\')' );
1607 return get_the_author_meta('ID');
1611 * Display the ID of the author of the current post.
1614 * @deprecated 2.8.0 Use the_author_meta()
1615 * @see the_author_meta()
1617 function the_author_ID() {
1618 _deprecated_function( __FUNCTION__, '2.8', 'the_author_meta(\'ID\')' );
1619 the_author_meta('ID');
1623 * Display the post content for the feed.
1625 * For encoding the html or the $encode_html parameter, there are three possible
1626 * values. '0' will make urls footnotes and use make_url_footnote(). '1' will
1627 * encode special characters and automatically display all of the content. The
1628 * value of '2' will strip all HTML tags from the content.
1630 * Also note that you cannot set the amount of words and not set the html
1631 * encoding. If that is the case, then the html encoding will default to 2,
1632 * which will strip all HTML tags.
1634 * To restrict the amount of words of the content, you can use the cut
1635 * parameter. If the content is less than the amount, then there won't be any
1636 * dots added to the end. If there is content left over, then dots will be added
1637 * and the rest of the content will be removed.
1641 * @deprecated 2.9.0 Use the_content_feed()
1642 * @see the_content_feed()
1644 * @param string $more_link_text Optional. Text to display when more content is available but not displayed.
1645 * @param int $stripteaser Optional. Default is 0.
1646 * @param string $more_file Optional.
1647 * @param int $cut Optional. Amount of words to keep for the content.
1648 * @param int $encode_html Optional. How to encode the content.
1650 function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) {
1651 _deprecated_function( __FUNCTION__, '2.9', 'the_content_feed' );
1652 $content = get_the_content($more_link_text, $stripteaser);
1653 $content = apply_filters('the_content_rss', $content);
1654 if ( $cut && !$encode_html )
1656 if ( 1== $encode_html ) {
1657 $content = esc_html($content);
1659 } elseif ( 0 == $encode_html ) {
1660 $content = make_url_footnote($content);
1661 } elseif ( 2 == $encode_html ) {
1662 $content = strip_tags($content);
1665 $blah = explode(' ', $content);
1666 if ( count($blah) > $cut ) {
1674 /** @todo Check performance, might be faster to use array slice instead. */
1675 for ( $i=0; $i<$k; $i++ )
1676 $excerpt .= $blah[$i].' ';
1677 $excerpt .= ($use_dotdotdot) ? '...' : '';
1678 $content = $excerpt;
1680 $content = str_replace(']]>', ']]>', $content);
1685 * Strip HTML and put links at the bottom of stripped content.
1687 * Searches for all of the links, strips them out of the content, and places
1688 * them at the bottom of the content with numbers.
1693 * @param string $content Content to get links
1694 * @return string HTML stripped out of content with links at the bottom.
1696 function make_url_footnote( $content ) {
1697 _deprecated_function( __FUNCTION__, '2.9', '' );
1698 preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches );
1699 $links_summary = "\n";
1700 for ( $i = 0, $c = count( $matches[0] ); $i < $c; $i++ ) {
1701 $link_match = $matches[0][$i];
1702 $link_number = '['.($i+1).']';
1703 $link_url = $matches[2][$i];
1704 $link_text = $matches[4][$i];
1705 $content = str_replace( $link_match, $link_text . ' ' . $link_number, $content );
1706 $link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url;
1707 $links_summary .= "\n" . $link_number . ' ' . $link_url;
1709 $content = strip_tags( $content );
1710 $content .= $links_summary;
1715 * Retrieve translated string with vertical bar context
1717 * Quite a few times, there will be collisions with similar translatable text
1718 * found in more than two places but with different translated context.
1720 * In order to use the separate contexts, the _c() function is used and the
1721 * translatable string uses a pipe ('|') which has the context the string is in.
1723 * When the translated string is returned, it is everything before the pipe, not
1724 * including the pipe character. If there is no pipe in the translated text then
1725 * everything is returned.
1728 * @deprecated 2.9.0 Use _x()
1731 * @param string $text Text to translate
1732 * @param string $domain Optional. Domain to retrieve the translated text
1733 * @return string Translated context string without pipe
1735 function _c( $text, $domain = 'default' ) {
1736 _deprecated_function( __FUNCTION__, '2.9', '_x()' );
1737 return before_last_bar( translate( $text, $domain ) );
1741 * Translates $text like translate(), but assumes that the text
1742 * contains a context after its last vertical bar.
1745 * @deprecated 3.0.0 Use _x()
1748 * @param string $text Text to translate
1749 * @param string $domain Domain to retrieve the translated text
1750 * @return string Translated text
1752 function translate_with_context( $text, $domain = 'default' ) {
1753 _deprecated_function( __FUNCTION__, '2.9', '_x()' );
1754 return before_last_bar( translate( $text, $domain ) );
1758 * A version of _n(), which supports contexts.
1759 * Strips everything from the translation after the last bar.
1762 * @deprecated 3.0.0 Use _nx()
1765 function _nc( $single, $plural, $number, $domain = 'default' ) {
1766 _deprecated_function( __FUNCTION__, '2.9', '_nx()' );
1767 return before_last_bar( _n( $single, $plural, $number, $domain ) );
1771 * Retrieve the plural or single form based on the amount.
1774 * @deprecated 2.8.0 Use _n()
1777 function __ngettext() {
1778 _deprecated_function( __FUNCTION__, '2.8', '_n()' );
1779 $args = func_get_args();
1780 return call_user_func_array('_n', $args);
1784 * Register plural strings in POT file, but don't translate them.
1787 * @deprecated 2.8.0 Use _n_noop()
1790 function __ngettext_noop() {
1791 _deprecated_function( __FUNCTION__, '2.8', '_n_noop()' );
1792 $args = func_get_args();
1793 return call_user_func_array('_n_noop', $args);
1798 * Retrieve all autoload options, or all options if no autoloaded ones exist.
1801 * @deprecated 3.0.0 Use wp_load_alloptions())
1802 * @see wp_load_alloptions()
1804 * @return array List of all options.
1806 function get_alloptions() {
1807 _deprecated_function( __FUNCTION__, '3.0', 'wp_load_alloptions()' );
1808 return wp_load_alloptions();
1812 * Retrieve HTML content of attachment image with link.
1815 * @deprecated 2.5.0 Use wp_get_attachment_link()
1816 * @see wp_get_attachment_link()
1818 * @param int $id Optional. Post ID.
1819 * @param bool $fullsize Optional, default is false. Whether to use full size image.
1820 * @param array $max_dims Optional. Max image dimensions.
1821 * @param bool $permalink Optional, default is false. Whether to include permalink to image.
1824 function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) {
1825 _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_link()' );
1827 $_post = get_post($id);
1829 if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) )
1830 return __('Missing Attachment');
1833 $url = get_attachment_link($_post->ID);
1835 $post_title = esc_attr($_post->post_title);
1837 $innerHTML = get_attachment_innerHTML($_post->ID, $fullsize, $max_dims);
1838 return "<a href='$url' title='$post_title'>$innerHTML</a>";
1842 * Retrieve icon URL and Path.
1845 * @deprecated 2.5.0 Use wp_get_attachment_image_src()
1846 * @see wp_get_attachment_image_src()
1848 * @param int $id Optional. Post ID.
1849 * @param bool $fullsize Optional, default to false. Whether to have full image.
1850 * @return array Icon URL and full path to file, respectively.
1852 function get_attachment_icon_src( $id = 0, $fullsize = false ) {
1853 _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_image_src()' );
1855 if ( !$post = get_post($id) )
1858 $file = get_attached_file( $post->ID );
1860 if ( !$fullsize && $src = wp_get_attachment_thumb_url( $post->ID ) ) {
1861 // We have a thumbnail desired, specified and existing
1863 $src_file = basename($src);
1864 } elseif ( wp_attachment_is_image( $post->ID ) ) {
1865 // We have an image without a thumbnail
1867 $src = wp_get_attachment_url( $post->ID );
1868 $src_file = & $file;
1869 } elseif ( $src = wp_mime_type_icon( $post->ID ) ) {
1870 // No thumb, no image. We'll look for a mime-related icon instead.
1872 $icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' );
1873 $src_file = $icon_dir . '/' . basename($src);
1876 if ( !isset($src) || !$src )
1879 return array($src, $src_file);
1883 * Retrieve HTML content of icon attachment image element.
1886 * @deprecated 2.5.0 Use wp_get_attachment_image()
1887 * @see wp_get_attachment_image()
1889 * @param int $id Optional. Post ID.
1890 * @param bool $fullsize Optional, default to false. Whether to have full size image.
1891 * @param array $max_dims Optional. Dimensions of image.
1892 * @return false|string HTML content.
1894 function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) {
1895 _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_image()' );
1897 if ( !$post = get_post($id) )
1900 if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) )
1903 list($src, $src_file) = $src;
1905 // Do we need to constrain the image?
1906 if ( ($max_dims = apply_filters('attachment_max_dims', $max_dims)) && file_exists($src_file) ) {
1908 $imagesize = getimagesize($src_file);
1910 if (($imagesize[0] > $max_dims[0]) || $imagesize[1] > $max_dims[1] ) {
1911 $actual_aspect = $imagesize[0] / $imagesize[1];
1912 $desired_aspect = $max_dims[0] / $max_dims[1];
1914 if ( $actual_aspect >= $desired_aspect ) {
1915 $height = $actual_aspect * $max_dims[0];
1916 $constraint = "width='{$max_dims[0]}' ";
1917 $post->iconsize = array($max_dims[0], $height);
1919 $width = $max_dims[1] / $actual_aspect;
1920 $constraint = "height='{$max_dims[1]}' ";
1921 $post->iconsize = array($width, $max_dims[1]);
1924 $post->iconsize = array($imagesize[0], $imagesize[1]);
1931 $post_title = esc_attr($post->post_title);
1933 $icon = "<img src='$src' title='$post_title' alt='$post_title' $constraint/>";
1935 return apply_filters( 'attachment_icon', $icon, $post->ID );
1939 * Retrieve HTML content of image element.
1942 * @deprecated 2.5.0 Use wp_get_attachment_image()
1943 * @see wp_get_attachment_image()
1945 * @param int $id Optional. Post ID.
1946 * @param bool $fullsize Optional, default to false. Whether to have full size image.
1947 * @param array $max_dims Optional. Dimensions of image.
1948 * @return false|string
1950 function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) {
1951 _deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_image()' );
1953 if ( !$post = get_post($id) )
1956 if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims))
1959 $innerHTML = esc_attr($post->post_title);
1961 return apply_filters('attachment_innerHTML', $innerHTML, $post->ID);
1965 * Retrieve bookmark data based on ID.
1968 * @deprecated 2.1.0 Use get_bookmark()
1969 * @see get_bookmark()
1971 * @param int $bookmark_id ID of link
1972 * @param string $output OBJECT, ARRAY_N, or ARRAY_A
1973 * @return object|array
1975 function get_link($bookmark_id, $output = OBJECT, $filter = 'raw') {
1976 _deprecated_function( __FUNCTION__, '2.1', 'get_bookmark()' );
1977 return get_bookmark($bookmark_id, $output, $filter);
1981 * Performs esc_url() for database or redirect usage.
1984 * @deprecated 2.8.0 Use esc_url_raw()
1985 * @see esc_url_raw()
1987 * @param string $url The URL to be cleaned.
1988 * @param array $protocols An array of acceptable protocols.
1989 * @return string The cleaned URL.
1991 function sanitize_url( $url, $protocols = null ) {
1992 _deprecated_function( __FUNCTION__, '2.8', 'esc_url_raw()' );
1993 return esc_url_raw( $url, $protocols );
1997 * Checks and cleans a URL.
1999 * A number of characters are removed from the URL. If the URL is for displaying
2000 * (the default behaviour) ampersands are also replaced. The 'clean_url' filter
2001 * is applied to the returned cleaned URL.
2004 * @deprecated 3.0.0 Use esc_url()
2005 * @see Alias for esc_url()
2007 * @param string $url The URL to be cleaned.
2008 * @param array $protocols Optional. An array of acceptable protocols.
2009 * @param string $context Optional. How the URL will be used. Default is 'display'.
2010 * @return string The cleaned $url after the 'clean_url' filter is applied.
2012 function clean_url( $url, $protocols = null, $context = 'display' ) {
2013 if ( $context == 'db' )
2014 _deprecated_function( 'clean_url( $context = \'db\' )', '3.0', 'esc_url_raw()' );
2016 _deprecated_function( __FUNCTION__, '3.0', 'esc_url()' );
2017 return esc_url( $url, $protocols, $context );
2021 * Escape single quotes, specialchar double quotes, and fix line endings.
2023 * The filter 'js_escape' is also applied by esc_js()
2026 * @deprecated 2.8.0 Use esc_js()
2029 * @param string $text The text to be escaped.
2030 * @return string Escaped text.
2032 function js_escape( $text ) {
2033 _deprecated_function( __FUNCTION__, '2.8', 'esc_js()' );
2034 return esc_js( $text );
2038 * Escaping for HTML blocks.
2040 * @deprecated 2.8.0 Use esc_html()
2043 function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
2044 _deprecated_function( __FUNCTION__, '2.8', 'esc_html()' );
2045 if ( func_num_args() > 1 ) { // Maintain backwards compat for people passing additional args
2046 $args = func_get_args();
2047 return call_user_func_array( '_wp_specialchars', $args );
2049 return esc_html( $string );
2054 * Escaping for HTML attributes.
2057 * @deprecated 2.8.0 Use esc_attr()
2060 * @param string $text
2063 function attribute_escape( $text ) {
2064 _deprecated_function( __FUNCTION__, '2.8', 'esc_attr()' );
2065 return esc_attr( $text );
2069 * Register widget for sidebar with backwards compatibility.
2071 * Allows $name to be an array that accepts either three elements to grab the
2072 * first element and the third for the name or just uses the first element of
2073 * the array for the name.
2075 * Passes to {@link wp_register_sidebar_widget()} after argument list and
2076 * backwards compatibility is complete.
2079 * @deprecated 2.8.0 Use wp_register_sidebar_widget()
2080 * @see wp_register_sidebar_widget()
2082 * @param string|int $name Widget ID.
2083 * @param callable $output_callback Run when widget is called.
2084 * @param string $classname Classname widget option.
2085 * @param mixed $params ,... Widget parameters.
2087 function register_sidebar_widget($name, $output_callback, $classname = '') {
2088 _deprecated_function( __FUNCTION__, '2.8', 'wp_register_sidebar_widget()' );
2090 if ( is_array($name) ) {
2091 if ( count($name) == 3 )
2092 $name = sprintf($name[0], $name[2]);
2097 $id = sanitize_title($name);
2099 if ( !empty($classname) && is_string($classname) )
2100 $options['classname'] = $classname;
2101 $params = array_slice(func_get_args(), 2);
2102 $args = array($id, $name, $output_callback, $options);
2103 if ( !empty($params) )
2104 $args = array_merge($args, $params);
2106 call_user_func_array('wp_register_sidebar_widget', $args);
2110 * Alias of {@link wp_unregister_sidebar_widget()}.
2113 * @deprecated 2.8.0 Use wp_unregister_sidebar_widget()
2114 * @see wp_unregister_sidebar_widget()
2116 * @param int|string $id Widget ID.
2118 function unregister_sidebar_widget($id) {
2119 _deprecated_function( __FUNCTION__, '2.8', 'wp_unregister_sidebar_widget()' );
2120 return wp_unregister_sidebar_widget($id);
2124 * Registers widget control callback for customizing options.
2126 * Allows $name to be an array that accepts either three elements to grab the
2127 * first element and the third for the name or just uses the first element of
2128 * the array for the name.
2130 * Passes to wp_register_widget_control() after the argument list has
2134 * @deprecated 2.8.0 Use wp_register_widget_control()
2135 * @see wp_register_widget_control()
2137 * @param int|string $name Sidebar ID.
2138 * @param callable $control_callback Widget control callback to display and process form.
2139 * @param int $width Widget width.
2140 * @param int $height Widget height.
2142 function register_widget_control($name, $control_callback, $width = '', $height = '') {
2143 _deprecated_function( __FUNCTION__, '2.8', 'wp_register_widget_control()' );
2145 if ( is_array($name) ) {
2146 if ( count($name) == 3 )
2147 $name = sprintf($name[0], $name[2]);
2152 $id = sanitize_title($name);
2154 if ( !empty($width) )
2155 $options['width'] = $width;
2156 if ( !empty($height) )
2157 $options['height'] = $height;
2158 $params = array_slice(func_get_args(), 4);
2159 $args = array($id, $name, $control_callback, $options);
2160 if ( !empty($params) )
2161 $args = array_merge($args, $params);
2163 call_user_func_array('wp_register_widget_control', $args);
2167 * Alias of wp_unregister_widget_control().
2170 * @deprecated 2.8.0 Use wp_unregister_widget_control()
2171 * @see wp_unregister_widget_control()
2173 * @param int|string $id Widget ID.
2175 function unregister_widget_control($id) {
2176 _deprecated_function( __FUNCTION__, '2.8', 'wp_unregister_widget_control()' );
2177 return wp_unregister_widget_control($id);
2181 * Remove user meta data.
2184 * @deprecated 3.0.0 Use delete_user_meta()
2185 * @see delete_user_meta()
2187 * @param int $user_id User ID.
2188 * @param string $meta_key Metadata key.
2189 * @param mixed $meta_value Metadata value.
2190 * @return bool True deletion completed and false if user_id is not a number.
2192 function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) {
2193 _deprecated_function( __FUNCTION__, '3.0', 'delete_user_meta()' );
2195 if ( !is_numeric( $user_id ) )
2197 $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
2199 if ( is_array($meta_value) || is_object($meta_value) )
2200 $meta_value = serialize($meta_value);
2201 $meta_value = trim( $meta_value );
2203 $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2205 if ( $cur && $cur->umeta_id )
2206 do_action( 'delete_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2208 if ( ! empty($meta_value) )
2209 $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) );
2211 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2213 clean_user_cache( $user_id );
2214 wp_cache_delete( $user_id, 'user_meta' );
2216 if ( $cur && $cur->umeta_id )
2217 do_action( 'deleted_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2223 * Retrieve user metadata.
2225 * If $user_id is not a number, then the function will fail over with a 'false'
2226 * boolean return value. Other returned values depend on whether there is only
2227 * one item to be returned, which be that single item type. If there is more
2228 * than one metadata value, then it will be list of metadata values.
2231 * @deprecated 3.0.0 Use get_user_meta()
2232 * @see get_user_meta()
2234 * @param int $user_id User ID
2235 * @param string $meta_key Optional. Metadata key.
2238 function get_usermeta( $user_id, $meta_key = '' ) {
2239 _deprecated_function( __FUNCTION__, '3.0', 'get_user_meta()' );
2241 $user_id = (int) $user_id;
2246 if ( !empty($meta_key) ) {
2247 $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
2248 $user = wp_cache_get($user_id, 'users');
2249 // Check the cached user object
2250 if ( false !== $user && isset($user->$meta_key) )
2251 $metas = array($user->$meta_key);
2253 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2255 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d", $user_id) );
2258 if ( empty($metas) ) {
2259 if ( empty($meta_key) )
2265 $metas = array_map('maybe_unserialize', $metas);
2267 if ( count($metas) == 1 )
2274 * Update metadata of user.
2276 * There is no need to serialize values, they will be serialized if it is
2277 * needed. The metadata key can only be a string with underscores. All else will
2280 * Will remove the metadata, if the meta value is empty.
2283 * @deprecated 3.0.0 Use update_user_meta()
2284 * @see update_user_meta()
2286 * @param int $user_id User ID
2287 * @param string $meta_key Metadata key.
2288 * @param mixed $meta_value Metadata value.
2289 * @return bool True on successful update, false on failure.
2291 function update_usermeta( $user_id, $meta_key, $meta_value ) {
2292 _deprecated_function( __FUNCTION__, '3.0', 'update_user_meta()' );
2294 if ( !is_numeric( $user_id ) )
2296 $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
2298 /** @todo Might need fix because usermeta data is assumed to be already escaped */
2299 if ( is_string($meta_value) )
2300 $meta_value = stripslashes($meta_value);
2301 $meta_value = maybe_serialize($meta_value);
2303 if (empty($meta_value)) {
2304 return delete_usermeta($user_id, $meta_key);
2307 $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
2310 do_action( 'update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2313 $wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') );
2314 elseif ( $cur->meta_value != $meta_value )
2315 $wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') );
2319 clean_user_cache( $user_id );
2320 wp_cache_delete( $user_id, 'user_meta' );
2323 do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value );
2325 do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2331 * Get users for the blog.
2333 * For setups that use the multi-blog feature. Can be used outside of the
2334 * multi-blog feature.
2337 * @deprecated 3.1.0 Use get_users()
2340 * @global wpdb $wpdb WordPress database abstraction object.
2341 * @uses $blog_id The Blog id of the blog for those that use more than one blog
2343 * @param int $id Blog ID.
2344 * @return array List of users that are part of that Blog ID
2346 function get_users_of_blog( $id = '' ) {
2347 _deprecated_function( __FUNCTION__, '3.1', 'get_users()' );
2349 global $wpdb, $blog_id;
2351 $id = (int) $blog_id;
2352 $blog_prefix = $wpdb->get_blog_prefix($id);
2353 $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" );
2358 * Enable/disable automatic general feed link outputting.
2361 * @deprecated 3.0.0 Use add_theme_support()
2362 * @see add_theme_support()
2364 * @param bool $add Optional, default is true. Add or remove links. Defaults to true.
2366 function automatic_feed_links( $add = true ) {
2367 _deprecated_function( __FUNCTION__, '3.0', "add_theme_support( 'automatic-feed-links' )" );
2370 add_theme_support( 'automatic-feed-links' );
2372 remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+
2376 * Retrieve user data based on field.
2379 * @deprecated 3.0.0 Use get_the_author_meta()
2380 * @see get_the_author_meta()
2382 function get_profile( $field, $user = false ) {
2383 _deprecated_function( __FUNCTION__, '3.0', 'get_the_author_meta()' );
2385 $user = get_user_by( 'login', $user );
2388 return get_the_author_meta( $field, $user );
2392 * Number of posts user has written.
2395 * @deprecated 3.0.0 Use count_user_posts()
2396 * @see count_user_posts()
2398 function get_usernumposts( $userid ) {
2399 _deprecated_function( __FUNCTION__, '3.0', 'count_user_posts()' );
2400 return count_user_posts( $userid );
2404 * Callback used to change %uXXXX to &#YYY; syntax
2410 * @param array $matches Single Match
2411 * @return string An HTML entity
2413 function funky_javascript_callback($matches) {
2414 return "&#".base_convert($matches[1],16,10).";";
2418 * Fixes JavaScript bugs in browsers.
2420 * Converts unicode characters to HTML numbered entities.
2428 * @param string $text Text to be made safe.
2429 * @return string Fixed text.
2431 function funky_javascript_fix($text) {
2432 _deprecated_function( __FUNCTION__, '3.0' );
2433 // Fixes for browsers' JavaScript bugs.
2434 global $is_macIE, $is_winIE;
2436 if ( $is_winIE || $is_macIE )
2437 $text = preg_replace_callback("/\%u([0-9A-F]{4,4})/",
2438 "funky_javascript_callback",
2445 * Checks that the taxonomy name exists.
2448 * @deprecated 3.0.0 Use taxonomy_exists()
2449 * @see taxonomy_exists()
2451 * @param string $taxonomy Name of taxonomy object
2452 * @return bool Whether the taxonomy exists.
2454 function is_taxonomy( $taxonomy ) {
2455 _deprecated_function( __FUNCTION__, '3.0', 'taxonomy_exists()' );
2456 return taxonomy_exists( $taxonomy );
2460 * Check if Term exists.
2463 * @deprecated 3.0.0 Use term_exists()
2464 * @see term_exists()
2466 * @param int|string $term The term to check
2467 * @param string $taxonomy The taxonomy name to use
2468 * @param int $parent ID of parent term under which to confine the exists search.
2469 * @return mixed Get the term id or Term Object, if exists.
2471 function is_term( $term, $taxonomy = '', $parent = 0 ) {
2472 _deprecated_function( __FUNCTION__, '3.0', 'term_exists()' );
2473 return term_exists( $term, $taxonomy, $parent );
2477 * Is the current admin page generated by a plugin?
2479 * Use global $plugin_page and/or get_plugin_page_hookname() hooks.
2484 * @global $plugin_page
2488 function is_plugin_page() {
2489 _deprecated_function( __FUNCTION__, '3.1' );
2491 global $plugin_page;
2493 if ( isset($plugin_page) )
2500 * Update the categories cache.
2502 * This function does not appear to be used anymore or does not appear to be
2503 * needed. It might be a legacy function left over from when there was a need
2504 * for updating the category cache.
2509 * @return bool Always return True
2511 function update_category_cache() {
2512 _deprecated_function( __FUNCTION__, '3.1' );
2518 * Check for PHP timezone support
2525 function wp_timezone_supported() {
2526 _deprecated_function( __FUNCTION__, '3.2' );
2532 * Display editor: TinyMCE, HTML, or both.
2535 * @deprecated 3.3.0 Use wp_editor()
2538 * @param string $content Textarea content.
2539 * @param string $id Optional, default is 'content'. HTML ID attribute value.
2540 * @param string $prev_id Optional, not used
2541 * @param bool $media_buttons Optional, default is true. Whether to display media buttons.
2542 * @param int $tab_index Optional, not used
2544 function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2, $extended = true) {
2545 _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
2547 wp_editor( $content, $id, array( 'media_buttons' => $media_buttons ) );
2551 * Perform the query to get the $metavalues array(s) needed by _fill_user and _fill_many_users
2556 * @param array $ids User ID numbers list.
2557 * @return array of arrays. The array is indexed by user_id, containing $metavalues object arrays.
2559 function get_user_metavalues($ids) {
2560 _deprecated_function( __FUNCTION__, '3.3' );
2564 $ids = array_map('intval', $ids);
2565 foreach ( $ids as $id )
2566 $objects[$id] = array();
2568 $metas = update_meta_cache('user', $ids);
2570 foreach ( $metas as $id => $meta ) {
2571 foreach ( $meta as $key => $metavalues ) {
2572 foreach ( $metavalues as $value ) {
2573 $objects[$id][] = (object)array( 'user_id' => $id, 'meta_key' => $key, 'meta_value' => $value);
2582 * Sanitize every user field.
2584 * If the context is 'raw', then the user object or array will get minimal santization of the int fields.
2589 * @param object|array $user The User Object or Array
2590 * @param string $context Optional, default is 'display'. How to sanitize user fields.
2591 * @return object|array The now sanitized User Object or Array (will be the same type as $user)
2593 function sanitize_user_object($user, $context = 'display') {
2594 _deprecated_function( __FUNCTION__, '3.3' );
2596 if ( is_object($user) ) {
2597 if ( !isset($user->ID) )
2599 if ( ! ( $user instanceof WP_User ) ) {
2600 $vars = get_object_vars($user);
2601 foreach ( array_keys($vars) as $field ) {
2602 if ( is_string($user->$field) || is_numeric($user->$field) )
2603 $user->$field = sanitize_user_field($field, $user->$field, $user->ID, $context);
2606 $user->filter = $context;
2608 if ( !isset($user['ID']) )
2610 foreach ( array_keys($user) as $field )
2611 $user[$field] = sanitize_user_field($field, $user[$field], $user['ID'], $context);
2612 $user['filter'] = $context;
2619 * Get boundary post relational link.
2621 * Can either be start or end post relational link.
2626 * @param string $title Optional. Link title format.
2627 * @param bool $in_same_cat Optional. Whether link should be in a same category.
2628 * @param string $excluded_categories Optional. Excluded categories IDs.
2629 * @param bool $start Optional, default is true. Whether to display link to first or last post.
2632 function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) {
2633 _deprecated_function( __FUNCTION__, '3.3' );
2635 $posts = get_boundary_post($in_same_cat, $excluded_categories, $start);
2636 // If there is no post stop.
2637 if ( empty($posts) )
2640 // Even though we limited get_posts to return only 1 item it still returns an array of objects.
2643 if ( empty($post->post_title) )
2644 $post->post_title = $start ? __('First Post') : __('Last Post');
2646 $date = mysql2date(get_option('date_format'), $post->post_date);
2648 $title = str_replace('%title', $post->post_title, $title);
2649 $title = str_replace('%date', $date, $title);
2650 $title = apply_filters('the_title', $title, $post->ID);
2652 $link = $start ? "<link rel='start' title='" : "<link rel='end' title='";
2653 $link .= esc_attr($title);
2654 $link .= "' href='" . get_permalink($post) . "' />\n";
2656 $boundary = $start ? 'start' : 'end';
2657 return apply_filters( "{$boundary}_post_rel_link", $link );
2661 * Display relational link for the first post.
2666 * @param string $title Optional. Link title format.
2667 * @param bool $in_same_cat Optional. Whether link should be in a same category.
2668 * @param string $excluded_categories Optional. Excluded categories IDs.
2670 function start_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') {
2671 _deprecated_function( __FUNCTION__, '3.3' );
2673 echo get_boundary_post_rel_link($title, $in_same_cat, $excluded_categories, true);
2677 * Get site index relational link.
2684 function get_index_rel_link() {
2685 _deprecated_function( __FUNCTION__, '3.3' );
2687 $link = "<link rel='index' title='" . esc_attr( get_bloginfo( 'name', 'display' ) ) . "' href='" . esc_url( user_trailingslashit( get_bloginfo( 'url', 'display' ) ) ) . "' />\n";
2688 return apply_filters( "index_rel_link", $link );
2692 * Display relational link for the site index.
2697 function index_rel_link() {
2698 _deprecated_function( __FUNCTION__, '3.3' );
2700 echo get_index_rel_link();
2704 * Get parent post relational link.
2709 * @param string $title Optional. Link title format.
2712 function get_parent_post_rel_link($title = '%title') {
2713 _deprecated_function( __FUNCTION__, '3.3' );
2715 if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) )
2716 $post = get_post($GLOBALS['post']->post_parent);
2721 $date = mysql2date(get_option('date_format'), $post->post_date);
2723 $title = str_replace('%title', $post->post_title, $title);
2724 $title = str_replace('%date', $date, $title);
2725 $title = apply_filters('the_title', $title, $post->ID);
2727 $link = "<link rel='up' title='";
2728 $link .= esc_attr( $title );
2729 $link .= "' href='" . get_permalink($post) . "' />\n";
2731 return apply_filters( "parent_post_rel_link", $link );
2735 * Display relational link for parent item
2740 function parent_post_rel_link($title = '%title') {
2741 _deprecated_function( __FUNCTION__, '3.3' );
2743 echo get_parent_post_rel_link($title);
2747 * Add the "Dashboard"/"Visit Site" menu.
2752 function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) {
2753 _deprecated_function( __FUNCTION__, '3.3' );
2755 $user_id = get_current_user_id();
2757 if ( 0 != $user_id ) {
2759 $wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) );
2760 elseif ( is_multisite() )
2761 $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) );
2763 $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) );
2768 * Checks if the current user belong to a given blog.
2771 * @deprecated 3.3.0 Use is_user_member_of_blog()
2772 * @see is_user_member_of_blog()
2774 * @param int $blog_id Blog ID
2775 * @return bool True if the current users belong to $blog_id, false if not.
2777 function is_blog_user( $blog_id = 0 ) {
2778 _deprecated_function( __FUNCTION__, '3.3', 'is_user_member_of_blog()' );
2780 return is_user_member_of_blog( get_current_user_id(), $blog_id );
2784 * Open the file handle for debugging.
2787 * @deprecated 3.4.0 Use error_log()
2790 * @link http://www.php.net/manual/en/function.error-log.php
2792 function debug_fopen( $filename, $mode ) {
2793 _deprecated_function( __FUNCTION__, 'error_log()' );
2798 * Write contents to the file used for debugging.
2801 * @deprecated 3.4.0 Use error_log()
2804 * @link http://www.php.net/manual/en/function.error-log.php
2806 function debug_fwrite( $fp, $string ) {
2807 _deprecated_function( __FUNCTION__, 'error_log()' );
2808 if ( ! empty( $GLOBALS['debug'] ) )
2809 error_log( $string );
2813 * Close the debugging file handle.
2816 * @deprecated 3.4.0 Use error_log()
2819 * @link http://www.php.net/manual/en/function.error-log.php
2821 function debug_fclose( $fp ) {
2822 _deprecated_function( __FUNCTION__, 'error_log()' );
2826 * Retrieve list of themes with theme data in theme directory.
2828 * The theme is broken, if it doesn't have a parent theme and is missing either
2829 * style.css and, or index.php. If the theme has a parent theme then it is
2830 * broken, if it is missing style.css; index.php is optional.
2833 * @deprecated 3.4.0 Use wp_get_themes()
2834 * @see wp_get_themes()
2836 * @return array Theme list with theme data.
2838 function get_themes() {
2839 _deprecated_function( __FUNCTION__, '3.4', 'wp_get_themes()' );
2842 if ( isset( $wp_themes ) )
2845 $themes = wp_get_themes();
2846 $wp_themes = array();
2848 foreach ( $themes as $theme ) {
2849 $name = $theme->get('Name');
2850 if ( isset( $wp_themes[ $name ] ) )
2851 $wp_themes[ $name . '/' . $theme->get_stylesheet() ] = $theme;
2853 $wp_themes[ $name ] = $theme;
2860 * Retrieve theme data.
2863 * @deprecated 3.4.0 Use wp_get_theme()
2864 * @see wp_get_theme()
2866 * @param string $theme Theme name.
2867 * @return array|null Null, if theme name does not exist. Theme data, if exists.
2869 function get_theme( $theme ) {
2870 _deprecated_function( __FUNCTION__, '3.4', 'wp_get_theme( $stylesheet )' );
2872 $themes = get_themes();
2873 if ( is_array( $themes ) && array_key_exists( $theme, $themes ) )
2874 return $themes[ $theme ];
2879 * Retrieve current theme name.
2882 * @deprecated 3.4.0 Use wp_get_theme()
2883 * @see wp_get_theme()
2887 function get_current_theme() {
2888 _deprecated_function( __FUNCTION__, '3.4', 'wp_get_theme()' );
2890 if ( $theme = get_option( 'current_theme' ) )
2893 return wp_get_theme()->get('Name');
2897 * Accepts matches array from preg_replace_callback in wpautop() or a string.
2899 * Ensures that the contents of a `<pre>...</pre>` HTML block are not
2900 * converted into paragraphs or line-breaks.
2905 * @param array|string $matches The array or string
2906 * @return string The pre block without paragraph/line-break conversion.
2908 function clean_pre($matches) {
2909 _deprecated_function( __FUNCTION__, '3.4' );
2911 if ( is_array($matches) )
2912 $text = $matches[1] . $matches[2] . "</pre>";
2916 $text = str_replace(array('<br />', '<br/>', '<br>'), array('', '', ''), $text);
2917 $text = str_replace('<p>', "\n", $text);
2918 $text = str_replace('</p>', '', $text);
2925 * Add callbacks for image header display.
2928 * @deprecated 3.4.0 Use add_theme_support()
2929 * @see add_theme_support()
2931 * @param callable $wp_head_callback Call on 'wp_head' action.
2932 * @param callable $admin_head_callback Call on custom header administration screen.
2933 * @param callable $admin_preview_callback Output a custom header image div on the custom header administration screen. Optional.
2935 function add_custom_image_header( $wp_head_callback, $admin_head_callback, $admin_preview_callback = '' ) {
2936 _deprecated_function( __FUNCTION__, '3.4', 'add_theme_support( \'custom-header\', $args )' );
2938 'wp-head-callback' => $wp_head_callback,
2939 'admin-head-callback' => $admin_head_callback,
2941 if ( $admin_preview_callback )
2942 $args['admin-preview-callback'] = $admin_preview_callback;
2943 return add_theme_support( 'custom-header', $args );
2947 * Remove image header support.
2950 * @deprecated 3.4.0 Use remove_theme_support()
2951 * @see remove_theme_support()
2953 * @return null|bool Whether support was removed.
2955 function remove_custom_image_header() {
2956 _deprecated_function( __FUNCTION__, '3.4', 'remove_theme_support( \'custom-header\' )' );
2957 return remove_theme_support( 'custom-header' );
2961 * Add callbacks for background image display.
2964 * @deprecated 3.4.0 Use add_theme_support()
2965 * @see add_theme_support()
2967 * @param callable $wp_head_callback Call on 'wp_head' action.
2968 * @param callable $admin_head_callback Call on custom background administration screen.
2969 * @param callable $admin_preview_callback Output a custom background image div on the custom background administration screen. Optional.
2971 function add_custom_background( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' ) {
2972 _deprecated_function( __FUNCTION__, '3.4', 'add_theme_support( \'custom-background\', $args )' );
2974 if ( $wp_head_callback )
2975 $args['wp-head-callback'] = $wp_head_callback;
2976 if ( $admin_head_callback )
2977 $args['admin-head-callback'] = $admin_head_callback;
2978 if ( $admin_preview_callback )
2979 $args['admin-preview-callback'] = $admin_preview_callback;
2980 return add_theme_support( 'custom-background', $args );
2984 * Remove custom background support.
2987 * @deprecated 3.4.0 Use add_custom_background()
2988 * @see add_custom_background()
2990 * @return null|bool Whether support was removed.
2992 function remove_custom_background() {
2993 _deprecated_function( __FUNCTION__, '3.4', 'remove_theme_support( \'custom-background\' )' );
2994 return remove_theme_support( 'custom-background' );
2998 * Retrieve theme data from parsed theme file.
3001 * @deprecated 3.4.0 Use wp_get_theme()
3002 * @see wp_get_theme()
3004 * @param string $theme_file Theme file path.
3005 * @return array Theme data.
3007 function get_theme_data( $theme_file ) {
3008 _deprecated_function( __FUNCTION__, '3.4', 'wp_get_theme()' );
3009 $theme = new WP_Theme( basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) );
3011 $theme_data = array(
3012 'Name' => $theme->get('Name'),
3013 'URI' => $theme->display('ThemeURI', true, false),
3014 'Description' => $theme->display('Description', true, false),
3015 'Author' => $theme->display('Author', true, false),
3016 'AuthorURI' => $theme->display('AuthorURI', true, false),
3017 'Version' => $theme->get('Version'),
3018 'Template' => $theme->get('Template'),
3019 'Status' => $theme->get('Status'),
3020 'Tags' => $theme->get('Tags'),
3021 'Title' => $theme->get('Name'),
3022 'AuthorName' => $theme->get('Author'),
3025 foreach ( apply_filters( 'extra_theme_headers', array() ) as $extra_header ) {
3026 if ( ! isset( $theme_data[ $extra_header ] ) )
3027 $theme_data[ $extra_header ] = $theme->get( $extra_header );
3034 * Alias of update_post_cache().
3036 * @see update_post_cache() Posts and pages are the same, alias is intentional
3039 * @deprecated 3.4.0 Use update_post_cache()
3040 * @see update_post_cache()
3042 * @param array $pages list of page objects
3044 function update_page_cache( &$pages ) {
3045 _deprecated_function( __FUNCTION__, '3.4', 'update_post_cache()' );
3047 update_post_cache( $pages );
3051 * Will clean the page in the cache.
3053 * Clean (read: delete) page from cache that matches $id. Will also clean cache
3054 * associated with 'all_page_ids' and 'get_pages'.
3057 * @deprecated 3.4.0 Use clean_post_cache
3058 * @see clean_post_cache()
3060 * @param int $id Page ID to clean
3062 function clean_page_cache( $id ) {
3063 _deprecated_function( __FUNCTION__, '3.4', 'clean_post_cache()' );
3065 clean_post_cache( $id );
3069 * Retrieve nonce action "Are you sure" message.
3071 * Deprecated in 3.4.1 and 3.5.0. Backported to 3.3.3.
3074 * @deprecated 3.4.1 Use wp_nonce_ays()
3075 * @see wp_nonce_ays()
3077 * @param string $action Nonce action.
3078 * @return string Are you sure message.
3080 function wp_explain_nonce( $action ) {
3081 _deprecated_function( __FUNCTION__, '3.4.1', 'wp_nonce_ays()' );
3082 return __( 'Are you sure you want to do this?' );
3086 * Display "sticky" CSS class, if a post is sticky.
3089 * @deprecated 3.5.0 Use post_class()
3092 * @param int $post_id An optional post ID.
3094 function sticky_class( $post_id = null ) {
3095 _deprecated_function( __FUNCTION__, '3.5', 'post_class()' );
3096 if ( is_sticky( $post_id ) )
3101 * Retrieve post ancestors.
3103 * This is no longer needed as WP_Post lazy-loads the ancestors
3104 * property with get_post_ancestors().
3107 * @deprecated 3.5.0 Use get_post_ancestors()
3108 * @see get_post_ancestors()
3110 function _get_post_ancestors( &$post ) {
3111 _deprecated_function( __FUNCTION__, '3.5' );
3115 * Load an image from a string, if PHP supports it.
3118 * @deprecated 3.5.0 Use wp_get_image_editor()
3119 * @see wp_get_image_editor()
3121 * @param string $file Filename of the image to load.
3122 * @return resource The resulting image resource on success, Error string on failure.
3124 function wp_load_image( $file ) {
3125 _deprecated_function( __FUNCTION__, '3.5', 'wp_get_image_editor()' );
3127 if ( is_numeric( $file ) )
3128 $file = get_attached_file( $file );
3130 if ( ! is_file( $file ) )
3131 return sprintf(__('File “%s” doesn’t exist?'), $file);
3133 if ( ! function_exists('imagecreatefromstring') )
3134 return __('The GD image library is not installed.');
3136 // Set artificially high because GD uses uncompressed images in memory
3137 @ini_set( 'memory_limit', apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) );
3138 $image = imagecreatefromstring( file_get_contents( $file ) );
3140 if ( !is_resource( $image ) )
3141 return sprintf(__('File “%s” is not an image.'), $file);
3147 * Scale down an image to fit a particular size and save a new copy of the image.
3149 * The PNG transparency will be preserved using the function, as well as the
3150 * image type. If the file going in is PNG, then the resized image is going to
3151 * be PNG. The only supported image types are PNG, GIF, and JPEG.
3153 * Some functionality requires API to exist, so some PHP version may lose out
3154 * support. This is not the fault of WordPress (where functionality is
3155 * downgraded, not actual defects), but of your PHP version.
3158 * @deprecated 3.5.0 Use wp_get_image_editor()
3159 * @see wp_get_image_editor()
3161 * @param string $file Image file path.
3162 * @param int $max_w Maximum width to resize to.
3163 * @param int $max_h Maximum height to resize to.
3164 * @param bool $crop Optional. Whether to crop image or resize.
3165 * @param string $suffix Optional. File suffix.
3166 * @param string $dest_path Optional. New image file path.
3167 * @param int $jpeg_quality Optional, default is 90. Image quality percentage.
3168 * @return mixed WP_Error on failure. String with new destination path.
3170 function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) {
3171 _deprecated_function( __FUNCTION__, '3.5', 'wp_get_image_editor()' );
3173 $editor = wp_get_image_editor( $file );
3174 if ( is_wp_error( $editor ) )
3176 $editor->set_quality( $jpeg_quality );
3178 $resized = $editor->resize( $max_w, $max_h, $crop );
3179 if ( is_wp_error( $resized ) )
3182 $dest_file = $editor->generate_filename( $suffix, $dest_path );
3183 $saved = $editor->save( $dest_file );
3185 if ( is_wp_error( $saved ) )
3192 * Retrieve a single post, based on post ID.
3194 * Has categories in 'post_category' property or key. Has tags in 'tags_input'
3198 * @deprecated 3.5.0 Use get_post()
3201 * @param int $postid Post ID.
3202 * @param string $mode How to return result, either OBJECT, ARRAY_N, or ARRAY_A.
3203 * @return WP_Post|null Post object or array holding post contents and information
3205 function wp_get_single_post( $postid = 0, $mode = OBJECT ) {
3206 _deprecated_function( __FUNCTION__, '3.5', 'get_post()' );
3207 return get_post( $postid, $mode );
3211 * Check that the user login name and password is correct.
3214 * @deprecated 3.5.0 Use wp_authenticate()
3215 * @see wp_authenticate()
3217 * @param string $user_login User name.
3218 * @param string $user_pass User password.
3219 * @return bool False if does not authenticate, true if username and password authenticates.
3221 function user_pass_ok($user_login, $user_pass) {
3222 _deprecated_function( __FUNCTION__, '3.5', 'wp_authenticate()' );
3223 $user = wp_authenticate( $user_login, $user_pass );
3224 if ( is_wp_error( $user ) )
3231 * Callback formerly fired on the save_post hook. No longer needed.
3236 function _save_post_hook() {}
3239 * Check if the installed version of GD supports particular image type
3242 * @deprecated 3.5.0 Use wp_image_editor_supports()
3243 * @see wp_image_editor_supports()
3245 * @param string $mime_type
3248 function gd_edit_image_support($mime_type) {
3249 _deprecated_function( __FUNCTION__, '3.5', 'wp_image_editor_supports()' );
3251 if ( function_exists('imagetypes') ) {
3252 switch( $mime_type ) {
3254 return (imagetypes() & IMG_JPG) != 0;
3256 return (imagetypes() & IMG_PNG) != 0;
3258 return (imagetypes() & IMG_GIF) != 0;
3261 switch( $mime_type ) {
3263 return function_exists('imagecreatefromjpeg');
3265 return function_exists('imagecreatefrompng');
3267 return function_exists('imagecreatefromgif');
3274 * Converts an integer byte value to a shorthand byte value.
3277 * @deprecated 3.6.0 Use size_format()
3278 * @see size_format()
3280 * @param int $bytes An integer byte value.
3281 * @return string A shorthand byte value.
3283 function wp_convert_bytes_to_hr( $bytes ) {
3284 _deprecated_function( __FUNCTION__, '3.6', 'size_format()' );
3286 $units = array( 0 => 'B', 1 => 'kB', 2 => 'MB', 3 => 'GB', 4 => 'TB' );
3287 $log = log( $bytes, KB_IN_BYTES );
3288 $power = (int) $log;
3289 $size = pow( KB_IN_BYTES, $log - $power );
3291 if ( ! is_nan( $size ) && array_key_exists( $power, $units ) ) {
3292 $unit = $units[ $power ];
3298 return $size . $unit;
3302 * Formerly used internally to tidy up the search terms.
3308 function _search_terms_tidy( $t ) {
3309 _deprecated_function( __FUNCTION__, '3.7' );
3310 return trim( $t, "\"'\n\r " );
3314 * Determine if TinyMCE is available.
3316 * Checks to see if the user has deleted the tinymce files to slim down
3317 * their WordPress install.
3322 * @return bool Whether TinyMCE exists.
3324 function rich_edit_exists() {
3325 global $wp_rich_edit_exists;
3326 _deprecated_function( __FUNCTION__, '3.9' );
3328 if ( ! isset( $wp_rich_edit_exists ) )
3329 $wp_rich_edit_exists = file_exists( ABSPATH . WPINC . '/js/tinymce/tinymce.js' );
3331 return $wp_rich_edit_exists;
3335 * Old callback for tag link tooltips.
3341 function default_topic_count_text( $count ) {
3346 * Formerly used to escape strings before inserting into the DB.
3348 * Has not performed this function for many, many years. Use wpdb::prepare() instead.
3353 * @param string $content The text to format.
3354 * @return string The very same text.
3356 function format_to_post( $content ) {
3357 _deprecated_function( __FUNCTION__, '3.9' );
3362 * Formerly used to escape strings before searching the DB. It was poorly documented and never worked as described.
3365 * @deprecated 4.0.0 Use wpdb::esc_like()
3366 * @see wpdb::esc_like()
3368 * @param string $text The text to be escaped.
3369 * @return string text, safe for inclusion in LIKE query.
3371 function like_escape($text) {
3372 _deprecated_function( __FUNCTION__, '4.0', 'wpdb::esc_like()' );
3373 return str_replace( array( "%", "_" ), array( "\\%", "\\_" ), $text );
3377 * Determines if the URL can be accessed over SSL.
3379 * Determines if the URL can be accessed over SSL by using the WordPress HTTP API to access
3380 * the URL using https as the scheme.
3385 * @param string $url The URL to test.
3386 * @return bool Whether SSL access is available.
3388 function url_is_accessable_via_ssl( $url ) {
3389 _deprecated_function( __FUNCTION__, '4.0' );
3391 $response = wp_remote_get( set_url_scheme( $url, 'https' ) );
3393 if ( !is_wp_error( $response ) ) {
3394 $status = wp_remote_retrieve_response_code( $response );
3395 if ( 200 == $status || 401 == $status ) {
3404 * Start preview theme output buffer.
3406 * Will only perform task if the user has permissions and template and preview
3407 * query variables exist.
3412 function preview_theme() {
3413 _deprecated_function( __FUNCTION__, '4.3' );
3417 * Private function to modify the current template when previewing a theme
3425 function _preview_theme_template_filter() {
3426 _deprecated_function( __FUNCTION__, '4.3' );
3431 * Private function to modify the current stylesheet when previewing a theme
3439 function _preview_theme_stylesheet_filter() {
3440 _deprecated_function( __FUNCTION__, '4.3' );
3445 * Callback function for ob_start() to capture all links in the theme.
3451 * @param string $content
3454 function preview_theme_ob_filter( $content ) {
3455 _deprecated_function( __FUNCTION__, '4.3' );
3460 * Manipulates preview theme links in order to control and maintain location.
3462 * Callback function for preg_replace_callback() to accept and filter matches.
3468 * @param array $matches
3471 function preview_theme_ob_filter_callback( $matches ) {
3472 _deprecated_function( __FUNCTION__, '4.3' );
3477 * Formats text for the rich text editor.
3479 * The filter 'richedit_pre' is applied here. If $text is empty the filter will
3480 * be applied to an empty string.
3485 * @param string $text The text to be formatted.
3486 * @return string The formatted text after filter is applied.
3488 function wp_richedit_pre($text) {
3489 _deprecated_function( __FUNCTION__, '4.3', 'format_for_editor()' );
3491 if ( empty( $text ) ) {
3493 * Filter text returned for the rich text editor.
3495 * This filter is first evaluated, and the value returned, if an empty string
3496 * is passed to wp_richedit_pre(). If an empty string is passed, it results
3497 * in a break tag and line feed.
3499 * If a non-empty string is passed, the filter is evaluated on the wp_richedit_pre()
3500 * return after being formatted.
3505 * @param string $output Text for the rich text editor.
3507 return apply_filters( 'richedit_pre', '' );
3510 $output = convert_chars($text);
3511 $output = wpautop($output);
3512 $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) );
3514 /** This filter is documented in wp-includes/deprecated.php */
3515 return apply_filters( 'richedit_pre', $output );
3519 * Formats text for the HTML editor.
3521 * Unless $output is empty it will pass through htmlspecialchars before the
3522 * 'htmledit_pre' filter is applied.
3525 * @deprecated 4.3.0 Use format_for_editor()
3526 * @see format_for_editor()
3528 * @param string $output The text to be formatted.
3529 * @return string Formatted text after filter applied.
3531 function wp_htmledit_pre($output) {
3532 _deprecated_function( __FUNCTION__, '4.3', 'format_for_editor()' );
3534 if ( !empty($output) )
3535 $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); // convert only < > &
3538 * Filter the text before it is formatted for the HTML editor.
3543 * @param string $output The HTML-formatted text.
3545 return apply_filters( 'htmledit_pre', $output );
3549 * Retrieve permalink from post ID.
3552 * @deprecated 4.4.0 Use get_permalink()
3553 * @see get_permalink()
3555 * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post.
3556 * @return string|false
3558 function post_permalink( $post_id = 0 ) {
3559 _deprecated_function( __FUNCTION__, '4.4', 'get_permalink()' );
3561 return get_permalink( $post_id );
3565 * Perform a HTTP HEAD or GET request.
3567 * If $file_path is a writable filename, this will do a GET request and write
3568 * the file to that path.
3571 * @deprecated 4.4.0 Use WP_Http
3574 * @param string $url URL to fetch.
3575 * @param string|bool $file_path Optional. File path to write request to. Default false.
3576 * @param int $red Optional. The number of Redirects followed, Upon 5 being hit,
3577 * returns false. Default 1.
3578 * @return bool|string False on failure and string of headers if HEAD request.
3580 function wp_get_http( $url, $file_path = false, $red = 1 ) {
3581 _deprecated_function( __FUNCTION__, '4.4', 'WP_Http' );
3583 @set_time_limit( 60 );
3589 $options['redirection'] = 5;
3591 if ( false == $file_path )
3592 $options['method'] = 'HEAD';
3594 $options['method'] = 'GET';
3596 $response = wp_safe_remote_request( $url, $options );
3598 if ( is_wp_error( $response ) )
3601 $headers = wp_remote_retrieve_headers( $response );
3602 $headers['response'] = wp_remote_retrieve_response_code( $response );
3604 // WP_HTTP no longer follows redirects for HEAD requests.
3605 if ( 'HEAD' == $options['method'] && in_array($headers['response'], array(301, 302)) && isset( $headers['location'] ) ) {
3606 return wp_get_http( $headers['location'], $file_path, ++$red );
3609 if ( false == $file_path )
3612 // GET request - write it to the supplied filename
3613 $out_fp = fopen($file_path, 'w');
3617 fwrite( $out_fp, wp_remote_retrieve_body( $response ) );
3625 * Whether SSL login should be forced.
3628 * @deprecated 4.4.0 Use force_ssl_admin()
3629 * @see force_ssl_admin()
3631 * @param string|bool $force Optional Whether to force SSL login. Default null.
3632 * @return bool True if forced, false if not forced.
3634 function force_ssl_login( $force = null ) {
3635 _deprecated_function( __FUNCTION__, '4.4', 'force_ssl_admin()' );
3636 return force_ssl_admin( $force );