1<?php 2/** 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. 6 * 7 * @package WordPress 8 * @subpackage Deprecated 9 */ 10 11/* 12 * Deprecated functions come here to die. 13 */ 14 15/** 16 * Retrieves all post data for a given post. 17 * 18 * @since 0.71 19 * @deprecated 1.5.1 Use get_post() 20 * @see get_post() 21 * 22 * @param int $postid Post ID. 23 * @return array Post data. 24 */ 25function get_postdata($postid) { 26 _deprecated_function( __FUNCTION__, '1.5.1', 'get_post()' ); 27 28 $post = get_post($postid); 29 30 $postdata = array ( 31 'ID' => $post->ID, 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 46 ); 47 48 return $postdata; 49} 50 51/** 52 * Sets up the WordPress Loop. 53 * 54 * Use The Loop instead. 55 * 56 * @link https://developer.wordpress.org/themes/basics/the-loop/ 57 * 58 * @since 1.0.1 59 * @deprecated 1.5.0 60 */ 61function start_wp() { 62 global $wp_query; 63 64 _deprecated_function( __FUNCTION__, '1.5.0', __('new WordPress Loop') ); 65 66 // Since the old style loop is being used, advance the query iterator here. 67 $wp_query->next_post(); 68 69 setup_postdata( get_post() ); 70} 71 72/** 73 * Returns or prints a category ID. 74 * 75 * @since 0.71 76 * @deprecated 0.71 Use get_the_category() 77 * @see get_the_category() 78 * 79 * @param bool $echo Optional. Whether to echo the output. Default true. 80 * @return int Category ID. 81 */ 82function the_category_ID($echo = true) { 83 _deprecated_function( __FUNCTION__, '0.71', 'get_the_category()' ); 84 85 // Grab the first cat in the list. 86 $categories = get_the_category(); 87 $cat = $categories[0]->term_id; 88 89 if ( $echo ) 90 echo $cat; 91 92 return $cat; 93} 94 95/** 96 * Prints a category with optional text before and after. 97 * 98 * @since 0.71 99 * @deprecated 0.71 Use get_the_category_by_ID() 100 * @see get_the_category_by_ID() 101 * 102 * @param string $before Optional. Text to display before the category. Default empty. 103 * @param string $after Optional. Text to display after the category. Default empty. 104 */ 105function the_category_head( $before = '', $after = '' ) { 106 global $currentcat, $previouscat; 107 108 _deprecated_function( __FUNCTION__, '0.71', 'get_the_category_by_ID()' ); 109 110 // Grab the first cat in the list. 111 $categories = get_the_category(); 112 $currentcat = $categories[0]->category_id; 113 if ( $currentcat != $previouscat ) { 114 echo $before; 115 echo get_the_category_by_ID($currentcat); 116 echo $after; 117 $previouscat = $currentcat; 118 } 119} 120 121/** 122 * Prints a link to the previous post. 123 * 124 * @since 1.5.0 125 * @deprecated 2.0.0 Use previous_post_link() 126 * @see previous_post_link() 127 * 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 134 */ 135function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') { 136 137 _deprecated_function( __FUNCTION__, '2.0.0', 'previous_post_link()' ); 138 139 if ( empty($in_same_cat) || 'no' == $in_same_cat ) 140 $in_same_cat = false; 141 else 142 $in_same_cat = true; 143 144 $post = get_previous_post($in_same_cat, $excluded_categories); 145 146 if ( !$post ) 147 return; 148 149 $string = '<a href="'.get_permalink($post->ID).'">'.$previous; 150 if ( 'yes' == $title ) 151 $string .= apply_filters('the_title', $post->post_title, $post->ID); 152 $string .= '</a>'; 153 $format = str_replace('%', $string, $format); 154 echo $format; 155} 156 157/** 158 * Prints link to the next post. 159 * 160 * @since 0.71 161 * @deprecated 2.0.0 Use next_post_link() 162 * @see next_post_link() 163 * 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 170 */ 171function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') { 172 _deprecated_function( __FUNCTION__, '2.0.0', 'next_post_link()' ); 173 174 if ( empty($in_same_cat) || 'no' == $in_same_cat ) 175 $in_same_cat = false; 176 else 177 $in_same_cat = true; 178 179 $post = get_next_post($in_same_cat, $excluded_categories); 180 181 if ( !$post ) 182 return; 183 184 $string = '<a href="'.get_permalink($post->ID).'">'.$next; 185 if ( 'yes' == $title ) 186 $string .= apply_filters('the_title', $post->post_title, $post->ID); 187 $string .= '</a>'; 188 $format = str_replace('%', $string, $format); 189 echo $format; 190} 191 192/** 193 * Whether user can create a post. 194 * 195 * @since 1.5.0 196 * @deprecated 2.0.0 Use current_user_can() 197 * @see current_user_can() 198 * 199 * @param int $user_id 200 * @param int $blog_id Not Used 201 * @param int $category_id Not Used 202 * @return bool 203 */ 204function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') { 205 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 206 207 $author_data = get_userdata($user_id); 208 return ($author_data->user_level > 1); 209} 210 211/** 212 * Whether user can create a post. 213 * 214 * @since 1.5.0 215 * @deprecated 2.0.0 Use current_user_can() 216 * @see current_user_can() 217 * 218 * @param int $user_id 219 * @param int $blog_id Not Used 220 * @param int $category_id Not Used 221 * @return bool 222 */ 223function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') { 224 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 225 226 $author_data = get_userdata($user_id); 227 return ($author_data->user_level >= 1); 228} 229 230/** 231 * Whether user can edit a post. 232 * 233 * @since 1.5.0 234 * @deprecated 2.0.0 Use current_user_can() 235 * @see current_user_can() 236 * 237 * @param int $user_id 238 * @param int $post_id 239 * @param int $blog_id Not Used 240 * @return bool 241 */ 242function user_can_edit_post($user_id, $post_id, $blog_id = 1) { 243 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 244 245 $author_data = get_userdata($user_id); 246 $post = get_post($post_id); 247 $post_author_data = get_userdata($post->post_author); 248 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) ) { 252 return true; 253 } else { 254 return false; 255 } 256} 257 258/** 259 * Whether user can delete a post. 260 * 261 * @since 1.5.0 262 * @deprecated 2.0.0 Use current_user_can() 263 * @see current_user_can() 264 * 265 * @param int $user_id 266 * @param int $post_id 267 * @param int $blog_id Not Used 268 * @return bool 269 */ 270function user_can_delete_post($user_id, $post_id, $blog_id = 1) { 271 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 272 273 // Right now if one can edit, one can delete. 274 return user_can_edit_post($user_id, $post_id, $blog_id); 275} 276 277/** 278 * Whether user can set new posts' dates. 279 * 280 * @since 1.5.0 281 * @deprecated 2.0.0 Use current_user_can() 282 * @see current_user_can() 283 * 284 * @param int $user_id 285 * @param int $blog_id Not Used 286 * @param int $category_id Not Used 287 * @return bool 288 */ 289function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') { 290 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 291 292 $author_data = get_userdata($user_id); 293 return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id)); 294} 295 296/** 297 * Whether user can delete a post. 298 * 299 * @since 1.5.0 300 * @deprecated 2.0.0 Use current_user_can() 301 * @see current_user_can() 302 * 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 307 */ 308function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) { 309 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 310 311 $author_data = get_userdata($user_id); 312 return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id)); 313} 314 315/** 316 * Whether user can delete a post. 317 * 318 * @since 1.5.0 319 * @deprecated 2.0.0 Use current_user_can() 320 * @see current_user_can() 321 * 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 326 */ 327function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) { 328 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 329 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); 332} 333 334/** 335 * Whether user can delete a post. 336 * 337 * @since 1.5.0 338 * @deprecated 2.0.0 Use current_user_can() 339 * @see current_user_can() 340 * 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 345 */ 346function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) { 347 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 348 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); 351} 352 353/** 354 * Can user can edit other user. 355 * 356 * @since 1.5.0 357 * @deprecated 2.0.0 Use current_user_can() 358 * @see current_user_can() 359 * 360 * @param int $user_id 361 * @param int $other_user 362 * @return bool 363 */ 364function user_can_edit_user($user_id, $other_user) { 365 _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); 366 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 ) 370 return true; 371 else 372 return false; 373} 374 375/** 376 * Gets the links associated with category $cat_name. 377 * 378 * @since 0.71 379 * @deprecated 2.1.0 Use get_bookmarks() 380 * @see get_bookmarks() 381 * 382 * @param string $cat_name Optional. The category name to use. If no match is found, uses all. 383 * Default 'noname'. 384 * @param string $before Optional. The HTML to output before the link. Default empty. 385 * @param string $after Optional. The HTML to output after the link. Default '<br />'. 386 * @param string $between Optional. The HTML to output between the link/image and its description. 387 * Not used if no image or $show_images is true. Default ' '. 388 * @param bool $show_images Optional. Whether to show images (if defined). Default true. 389 * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', 390 * 'description', 'rating', or 'owner'. Default 'id'. 391 * If you start the name with an underscore, the order will be reversed. 392 * Specifying 'rand' as the order will return links in a random order. 393 * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined. 394 * Default true. 395 * @param bool $show_rating Optional. Show rating stars/chars. Default false. 396 * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. 397 * Default -1. 398 * @param int $show_updated Optional. Whether to show last updated timestamp. Default 0. 399 */ 400function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = true, $orderby = 'id', 401 $show_description = true, $show_rating = false, 402 $limit = -1, $show_updated = 0) { 403 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); 404 405 $cat_id = -1; 406 $cat = get_term_by('name', $cat_name, 'link_category'); 407 if ( $cat ) 408 $cat_id = $cat->term_id; 409 410 get_links($cat_id, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated); 411} 412 413/** 414 * Gets the links associated with the named category. 415 * 416 * @since 1.0.1 417 * @deprecated 2.1.0 Use wp_list_bookmarks() 418 * @see wp_list_bookmarks() 419 * 420 * @param string $category The category to use. 421 * @param string $args 422 * @return string|null 423 */ 424function wp_get_linksbyname($category, $args = '') { 425 _deprecated_function(__FUNCTION__, '2.1.0', 'wp_list_bookmarks()'); 426 427 $defaults = array( 428 'after' => '<br />', 429 'before' => '', 430 'categorize' => 0, 431 'category_after' => '', 432 'category_before' => '', 433 'category_name' => $category, 434 'show_description' => 1, 435 'title_li' => '', 436 ); 437 438 $parsed_args = wp_parse_args( $args, $defaults ); 439 440 return wp_list_bookmarks($parsed_args); 441} 442 443/** 444 * Gets an array of link objects associated with category $cat_name. 445 * 446 * $links = get_linkobjectsbyname( 'fred' ); 447 * foreach ( $links as $link ) { 448 * echo '<li>' . $link->link_name . '</li>'; 449 * } 450 * 451 * @since 1.0.1 452 * @deprecated 2.1.0 Use get_bookmarks() 453 * @see get_bookmarks() 454 * 455 * @param string $cat_name Optional. The category name to use. If no match is found, uses all. 456 * Default 'noname'. 457 * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', 458 * 'description', 'rating', or 'owner'. Default 'name'. 459 * If you start the name with an underscore, the order will be reversed. 460 * Specifying 'rand' as the order will return links in a random order. 461 * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. 462 * Default -1. 463 * @return array 464 */ 465function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) { 466 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); 467 468 $cat_id = -1; 469 $cat = get_term_by('name', $cat_name, 'link_category'); 470 if ( $cat ) 471 $cat_id = $cat->term_id; 472 473 return get_linkobjects($cat_id, $orderby, $limit); 474} 475 476/** 477 * Gets an array of link objects associated with category n. 478 * 479 * Usage: 480 * 481 * $links = get_linkobjects(1); 482 * if ($links) { 483 * foreach ($links as $link) { 484 * echo '<li>'.$link->link_name.'<br />'.$link->link_description.'</li>'; 485 * } 486 * } 487 * 488 * Fields are: 489 * 490 * - link_id 491 * - link_url 492 * - link_name 493 * - link_image 494 * - link_target 495 * - link_category 496 * - link_description 497 * - link_visible 498 * - link_owner 499 * - link_rating 500 * - link_updated 501 * - link_rel 502 * - link_notes 503 * 504 * @since 1.0.1 505 * @deprecated 2.1.0 Use get_bookmarks() 506 * @see get_bookmarks() 507 * 508 * @param int $category Optional. The category to use. If no category supplied, uses all. 509 * Default 0. 510 * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', 511 * 'description', 'rating', or 'owner'. Default 'name'. 512 * If you start the name with an underscore, the order will be reversed. 513 * Specifying 'rand' as the order will return links in a random order. 514 * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. 515 * Default 0. 516 * @return array 517 */ 518function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) { 519 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); 520 521 $links = get_bookmarks( array( 'category' => $category, 'orderby' => $orderby, 'limit' => $limit ) ) ; 522 523 $links_array = array(); 524 foreach ($links as $link) 525 $links_array[] = $link; 526 527 return $links_array; 528} 529 530/** 531 * Gets the links associated with category 'cat_name' and display rating stars/chars. 532 * 533 * @since 0.71 534 * @deprecated 2.1.0 Use get_bookmarks() 535 * @see get_bookmarks() 536 * 537 * @param string $cat_name Optional. The category name to use. If no match is found, uses all. 538 * Default 'noname'. 539 * @param string $before Optional. The HTML to output before the link. Default empty. 540 * @param string $after Optional. The HTML to output after the link. Default '<br />'. 541 * @param string $between Optional. The HTML to output between the link/image and its description. 542 * Not used if no image or $show_images is true. Default ' '. 543 * @param bool $show_images Optional. Whether to show images (if defined). Default true. 544 * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', 545 * 'description', 'rating', or 'owner'. Default 'id'. 546 * If you start the name with an underscore, the order will be reversed. 547 * Specifying 'rand' as the order will return links in a random order. 548 * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined. 549 * Default true. 550 * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. 551 * Default -1. 552 * @param int $show_updated Optional. Whether to show last updated timestamp. Default 0. 553 */ 554function get_linksbyname_withrating($cat_name = "noname", $before = '', $after = '<br />', $between = " ", 555 $show_images = true, $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) { 556 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); 557 558 get_linksbyname($cat_name, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated); 559} 560 561/** 562 * Gets the links associated with category n and display rating stars/chars. 563 * 564 * @since 0.71 565 * @deprecated 2.1.0 Use get_bookmarks() 566 * @see get_bookmarks() 567 * 568 * @param int $category Optional. The category to use. If no category supplied, uses all. 569 * Default 0. 570 * @param string $before Optional. The HTML to output before the link. Default empty. 571 * @param string $after Optional. The HTML to output after the link. Default '<br />'. 572 * @param string $between Optional. The HTML to output between the link/image and its description. 573 * Not used if no image or $show_images is true. Default ' '. 574 * @param bool $show_images Optional. Whether to show images (if defined). Default true. 575 * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', 576 * 'description', 'rating', or 'owner'. Default 'id'. 577 * If you start the name with an underscore, the order will be reversed. 578 * Specifying 'rand' as the order will return links in a random order. 579 * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined. 580 * Default true. 581 * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. 582 * Default -1. 583 * @param int $show_updated Optional. Whether to show last updated timestamp. Default 0. 584 */ 585function get_links_withrating($category = -1, $before = '', $after = '<br />', $between = " ", $show_images = true, 586 $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) { 587 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); 588 589 get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated); 590} 591 592/** 593 * Gets the auto_toggle setting. 594 * 595 * @since 0.71 596 * @deprecated 2.1.0 597 * 598 * @param int $id The category to get. If no category supplied uses 0 599 * @return int Only returns 0. 600 */ 601function get_autotoggle($id = 0) { 602 _deprecated_function( __FUNCTION__, '2.1.0' ); 603 return 0; 604} 605 606/** 607 * Lists categories. 608 * 609 * @since 0.71 610 * @deprecated 2.1.0 Use wp_list_categories() 611 * @see wp_list_categories() 612 * 613 * @param int $optionall 614 * @param string $all 615 * @param string $sort_column 616 * @param string $sort_order 617 * @param string $file 618 * @param bool $list 619 * @param int $optiondates 620 * @param int $optioncount 621 * @param int $hide_empty 622 * @param int $use_desc_for_title 623 * @param bool $children 624 * @param int $child_of 625 * @param int $categories 626 * @param int $recurse 627 * @param string $feed 628 * @param string $feed_image 629 * @param string $exclude 630 * @param bool $hierarchical 631 * @return null|false 632 */ 633function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, 634 $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0, 635 $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) { 636 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' ); 637 638 $query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children', 639 'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical'); 640 return wp_list_cats($query); 641} 642 643/** 644 * Lists categories. 645 * 646 * @since 1.2.0 647 * @deprecated 2.1.0 Use wp_list_categories() 648 * @see wp_list_categories() 649 * 650 * @param string|array $args 651 * @return null|string|false 652 */ 653function wp_list_cats($args = '') { 654 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' ); 655 656 $parsed_args = wp_parse_args( $args ); 657 658 // Map to new names. 659 if ( isset($parsed_args['optionall']) && isset($parsed_args['all'])) 660 $parsed_args['show_option_all'] = $parsed_args['all']; 661 if ( isset($parsed_args['sort_column']) ) 662 $parsed_args['orderby'] = $parsed_args['sort_column']; 663 if ( isset($parsed_args['sort_order']) ) 664 $parsed_args['order'] = $parsed_args['sort_order']; 665 if ( isset($parsed_args['optiondates']) ) 666 $parsed_args['show_last_update'] = $parsed_args['optiondates']; 667 if ( isset($parsed_args['optioncount']) ) 668 $parsed_args['show_count'] = $parsed_args['optioncount']; 669 if ( isset($parsed_args['list']) ) 670 $parsed_args['style'] = $parsed_args['list'] ? 'list' : 'break'; 671 $parsed_args['title_li'] = ''; 672 673 return wp_list_categories($parsed_args); 674} 675 676/** 677 * Deprecated method for generating a drop-down of categories. 678 * 679 * @since 0.71 680 * @deprecated 2.1.0 Use wp_dropdown_categories() 681 * @see wp_dropdown_categories() 682 * 683 * @param int $optionall 684 * @param string $all 685 * @param string $orderby 686 * @param string $order 687 * @param int $show_last_update 688 * @param int $show_count 689 * @param int $hide_empty 690 * @param bool $optionnone 691 * @param int $selected 692 * @param int $exclude 693 * @return string 694 */ 695function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc', 696 $show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = false, 697 $selected = 0, $exclude = 0) { 698 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_dropdown_categories()' ); 699 700 $show_option_all = ''; 701 if ( $optionall ) 702 $show_option_all = $all; 703 704 $show_option_none = ''; 705 if ( $optionnone ) 706 $show_option_none = __('None'); 707 708 $vars = compact('show_option_all', 'show_option_none', 'orderby', 'order', 709 'show_last_update', 'show_count', 'hide_empty', 'selected', 'exclude'); 710 $query = add_query_arg($vars, ''); 711 return wp_dropdown_categories($query); 712} 713 714/** 715 * Lists authors. 716 * 717 * @since 1.2.0 718 * @deprecated 2.1.0 Use wp_list_authors() 719 * @see wp_list_authors() 720 * 721 * @param bool $optioncount 722 * @param bool $exclude_admin 723 * @param bool $show_fullname 724 * @param bool $hide_empty 725 * @param string $feed 726 * @param string $feed_image 727 * @return null|string 728 */ 729function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') { 730 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_authors()' ); 731 732 $args = compact('optioncount', 'exclude_admin', 'show_fullname', 'hide_empty', 'feed', 'feed_image'); 733 return wp_list_authors($args); 734} 735 736/** 737 * Retrieves a list of post categories. 738 * 739 * @since 1.0.1 740 * @deprecated 2.1.0 Use wp_get_post_categories() 741 * @see wp_get_post_categories() 742 * 743 * @param int $blogid Not Used 744 * @param int $post_ID 745 * @return array 746 */ 747function wp_get_post_cats($blogid = '1', $post_ID = 0) { 748 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_get_post_categories()' ); 749 return wp_get_post_categories($post_ID); 750} 751 752/** 753 * Sets the categories that the post ID belongs to. 754 * 755 * @since 1.0.1 756 * @deprecated 2.1.0 757 * @deprecated Use wp_set_post_categories() 758 * @see wp_set_post_categories() 759 * 760 * @param int $blogid Not used 761 * @param int $post_ID 762 * @param array $post_categories 763 * @return bool|mixed 764 */ 765function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) { 766 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_set_post_categories()' ); 767 return wp_set_post_categories($post_ID, $post_categories); 768} 769 770/** 771 * Retrieves a list of archives. 772 * 773 * @since 0.71 774 * @deprecated 2.1.0 Use wp_get_archives() 775 * @see wp_get_archives() 776 * 777 * @param string $type 778 * @param string $limit 779 * @param string $format 780 * @param string $before 781 * @param string $after 782 * @param bool $show_post_count 783 * @return string|null 784 */ 785function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) { 786 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_get_archives()' ); 787 $args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count'); 788 return wp_get_archives($args); 789} 790 791/** 792 * Returns or Prints link to the author's posts. 793 * 794 * @since 1.2.0 795 * @deprecated 2.1.0 Use get_author_posts_url() 796 * @see get_author_posts_url() 797 * 798 * @param bool $echo 799 * @param int $author_id 800 * @param string $author_nicename Optional. 801 * @return string|null 802 */ 803function get_author_link($echo, $author_id, $author_nicename = '') { 804 _deprecated_function( __FUNCTION__, '2.1.0', 'get_author_posts_url()' ); 805 806 $link = get_author_posts_url($author_id, $author_nicename); 807 808 if ( $echo ) 809 echo $link; 810 return $link; 811} 812 813/** 814 * Print list of pages based on arguments. 815 * 816 * @since 0.71 817 * @deprecated 2.1.0 Use wp_link_pages() 818 * @see wp_link_pages() 819 * 820 * @param string $before 821 * @param string $after 822 * @param string $next_or_number 823 * @param string $nextpagelink 824 * @param string $previouspagelink 825 * @param string $pagelink 826 * @param string $more_file 827 * @return string 828 */ 829function link_pages($before='<br />', $after='<br />', $next_or_number='number', $nextpagelink='next page', $previouspagelink='previous page', 830 $pagelink='%', $more_file='') { 831 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_link_pages()' ); 832 833 $args = compact('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file'); 834 return wp_link_pages($args); 835} 836 837/** 838 * Get value based on option. 839 * 840 * @since 0.71 841 * @deprecated 2.1.0 Use get_option() 842 * @see get_option() 843 * 844 * @param string $option 845 * @return string 846 */ 847function get_settings($option) { 848 _deprecated_function( __FUNCTION__, '2.1.0', 'get_option()' ); 849 850 return get_option($option); 851} 852 853/** 854 * Print the permalink of the current post in the loop. 855 * 856 * @since 0.71 857 * @deprecated 1.2.0 Use the_permalink() 858 * @see the_permalink() 859 */ 860function permalink_link() { 861 _deprecated_function( __FUNCTION__, '1.2.0', 'the_permalink()' ); 862 the_permalink(); 863} 864 865/** 866 * Print the permalink to the RSS feed. 867 * 868 * @since 0.71 869 * @deprecated 2.3.0 Use the_permalink_rss() 870 * @see the_permalink_rss() 871 * 872 * @param string $deprecated 873 */ 874function permalink_single_rss($deprecated = '') { 875 _deprecated_function( __FUNCTION__, '2.3.0', 'the_permalink_rss()' ); 876 the_permalink_rss(); 877} 878 879/** 880 * Gets the links associated with category. 881 * 882 * @since 1.0.1 883 * @deprecated 2.1.0 Use wp_list_bookmarks() 884 * @see wp_list_bookmarks() 885 * 886 * @param string $args a query string 887 * @return null|string 888 */ 889function wp_get_links($args = '') { 890 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' ); 891 892 if ( strpos( $args, '=' ) === false ) { 893 $cat_id = $args; 894 $args = add_query_arg( 'category', $cat_id, $args ); 895 } 896 897 $defaults = array( 898 'after' => '<br />', 899 'before' => '', 900 'between' => ' ', 901 'categorize' => 0, 902 'category' => '', 903 'echo' => true, 904 'limit' => -1, 905 'orderby' => 'name', 906 'show_description' => true, 907 'show_images' => true, 908 'show_rating' => false, 909 'show_updated' => true, 910 'title_li' => '', 911 ); 912 913 $parsed_args = wp_parse_args( $args, $defaults ); 914 915 return wp_list_bookmarks($parsed_args); 916} 917 918/** 919 * Gets the links associated with category by ID. 920 * 921 * @since 0.71 922 * @deprecated 2.1.0 Use get_bookmarks() 923 * @see get_bookmarks() 924 * 925 * @param int $category Optional. The category to use. If no category supplied uses all. 926 * Default 0. 927 * @param string $before Optional. The HTML to output before the link. Default empty. 928 * @param string $after Optional. The HTML to output after the link. Default '<br />'. 929 * @param string $between Optional. The HTML to output between the link/image and its description. 930 * Not used if no image or $show_images is true. Default ' '. 931 * @param bool $show_images Optional. Whether to show images (if defined). Default true. 932 * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', 933 * 'description', 'rating', or 'owner'. Default 'name'. 934 * If you start the name with an underscore, the order will be reversed. 935 * Specifying 'rand' as the order will return links in a random order. 936 * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined. 937 * Default true. 938 * @param bool $show_rating Optional. Show rating stars/chars. Default false. 939 * @param int $limit Optional. Limit to X entries. If not specified, all entries are shown. 940 * Default -1. 941 * @param int $show_updated Optional. Whether to show last updated timestamp. Default 1. 942 * @param bool $echo Whether to echo the results, or return them instead. 943 * @return null|string 944 */ 945function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name', 946 $show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $echo = true) { 947 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' ); 948 949 $order = 'ASC'; 950 if ( substr($orderby, 0, 1) == '_' ) { 951 $order = 'DESC'; 952 $orderby = substr($orderby, 1); 953 } 954 955 if ( $category == -1 ) // get_bookmarks() uses '' to signify all categories. 956 $category = ''; 957 958 $results = get_bookmarks(array('category' => $category, 'orderby' => $orderby, 'order' => $order, 'show_updated' => $show_updated, 'limit' => $limit)); 959 960 if ( !$results ) 961 return; 962 963 $output = ''; 964 965 foreach ( (array) $results as $row ) { 966 if ( !isset($row->recently_updated) ) 967 $row->recently_updated = false; 968 $output .= $before; 969 if ( $show_updated && $row->recently_updated ) 970 $output .= get_option('links_recently_updated_prepend'); 971 $the_link = '#'; 972 if ( !empty($row->link_url) ) 973 $the_link = esc_url($row->link_url); 974 $rel = $row->link_rel; 975 if ( '' != $rel ) 976 $rel = ' rel="' . $rel . '"'; 977 978 $desc = esc_attr(sanitize_bookmark_field('link_description', $row->link_description, $row->link_id, 'display')); 979 $name = esc_attr(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display')); 980 $title = $desc; 981 982 if ( $show_updated ) 983 if (substr($row->link_updated_f, 0, 2) != '00') 984 $title .= ' ('.__('Last updated') . ' ' . gmdate(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')'; 985 986 if ( '' != $title ) 987 $title = ' title="' . $title . '"'; 988 989 $alt = ' alt="' . $name . '"'; 990 991 $target = $row->link_target; 992 if ( '' != $target ) 993 $target = ' target="' . $target . '"'; 994 995 $output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>'; 996 997 if ( $row->link_image != null && $show_images ) { 998 if ( strpos($row->link_image, 'http') !== false ) 999 $output .= "<img src=\"$row->link_image\" $alt $title />"; 1000 else // If it's a relative path. 1001 $output .= "<img src=\"" . get_option('siteurl') . "$row->link_image\" $alt $title />"; 1002 } else { 1003 $output .= $name; 1004 } 1005 1006 $output .= '</a>'; 1007 1008 if ( $show_updated && $row->recently_updated ) 1009 $output .= get_option('links_recently_updated_append'); 1010 1011 if ( $show_description && '' != $desc ) 1012 $output .= $between . $desc; 1013 1014 if ($show_rating) { 1015 $output .= $between . get_linkrating($row); 1016 } 1017 1018 $output .= "$after\n"; 1019 } // End while. 1020 1021 if ( !$echo ) 1022 return $output; 1023 echo $output; 1024} 1025 1026/** 1027 * Output entire list of links by category. 1028 * 1029 * Output a list of all links, listed by category, using the settings in 1030 * $wpdb->linkcategories and output it as a nested HTML unordered list. 1031 * 1032 * @since 1.0.1 1033 * @deprecated 2.1.0 Use wp_list_bookmarks() 1034 * @see wp_list_bookmarks() 1035 * 1036 * @param string $order Sort link categories by 'name' or 'id' 1037 */ 1038function get_links_list($order = 'name') { 1039 _deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' ); 1040 1041 $order = strtolower($order); 1042 1043 // Handle link category sorting. 1044 $direction = 'ASC'; 1045 if ( '_' == substr($order,0,1) ) { 1046 $direction = 'DESC'; 1047 $order = substr($order,1); 1048 } 1049 1050 if ( !isset($direction) ) 1051 $direction = ''; 1052 1053 $cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0)); 1054 1055 // Display each category. 1056 if ( $cats ) { 1057 foreach ( (array) $cats as $cat ) { 1058 // Handle each category. 1059 1060 // Display the category name. 1061 echo ' <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name ) . "</h2>\n\t<ul>\n"; 1062 // Call get_links() with all the appropriate params. 1063 get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false); 1064 1065 // Close the last category. 1066 echo "\n\t</ul>\n</li>\n"; 1067 } 1068 } 1069} 1070 1071/** 1072 * Show the link to the links popup and the number of links. 1073 * 1074 * @since 0.71 1075 * @deprecated 2.1.0 1076 * 1077 * @param string $text the text of the link 1078 * @param int $width the width of the popup window 1079 * @param int $height the height of the popup window 1080 * @param string $file the page to open in the popup window 1081 * @param bool $count the number of links in the db 1082 */ 1083function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) { 1084 _deprecated_function( __FUNCTION__, '2.1.0' ); 1085} 1086 1087/** 1088 * Legacy function that retrieved the value of a link's link_rating field. 1089 * 1090 * @since 1.0.1 1091 * @deprecated 2.1.0 Use sanitize_bookmark_field() 1092 * @see sanitize_bookmark_field() 1093 * 1094 * @param object $link Link object. 1095 * @return mixed Value of the 'link_rating' field, false otherwise. 1096 */ 1097function get_linkrating( $link ) { 1098 _deprecated_function( __FUNCTION__, '2.1.0', 'sanitize_bookmark_field()' ); 1099 return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display'); 1100} 1101 1102/** 1103 * Gets the name of category by ID. 1104 * 1105 * @since 0.71 1106 * @deprecated 2.1.0 Use get_category() 1107 * @see get_category() 1108 * 1109 * @param int $id The category to get. If no category supplied uses 0 1110 * @return string 1111 */ 1112function get_linkcatname($id = 0) { 1113 _deprecated_function( __FUNCTION__, '2.1.0', 'get_category()' ); 1114 1115 $id = (int) $id; 1116 1117 if ( empty($id) ) 1118 return ''; 1119 1120 $cats = wp_get_link_cats($id); 1121 1122 if ( empty($cats) || ! is_array($cats) ) 1123 return ''; 1124 1125 $cat_id = (int) $cats[0]; // Take the first cat. 1126 1127 $cat = get_category($cat_id); 1128 return $cat->name; 1129} 1130 1131/** 1132 * Print RSS comment feed link. 1133 * 1134 * @since 1.0.1 1135 * @deprecated 2.5.0 Use post_comments_feed_link() 1136 * @see post_comments_feed_link() 1137 * 1138 * @param string $link_text 1139 */ 1140function comments_rss_link($link_text = 'Comments RSS') { 1141 _deprecated_function( __FUNCTION__, '2.5.0', 'post_comments_feed_link()' ); 1142 post_comments_feed_link($link_text); 1143} 1144 1145/** 1146 * Print/Return link to category RSS2 feed. 1147 * 1148 * @since 1.2.0 1149 * @deprecated 2.5.0 Use get_category_feed_link() 1150 * @see get_category_feed_link() 1151 * 1152 * @param bool $echo 1153 * @param int $cat_ID 1154 * @return string 1155 */ 1156function get_category_rss_link($echo = false, $cat_ID = 1) { 1157 _deprecated_function( __FUNCTION__, '2.5.0', 'get_category_feed_link()' ); 1158 1159 $link = get_category_feed_link($cat_ID, 'rss2'); 1160 1161 if ( $echo ) 1162 echo $link; 1163 return $link; 1164} 1165 1166/** 1167 * Print/Return link to author RSS feed. 1168 * 1169 * @since 1.2.0 1170 * @deprecated 2.5.0 Use get_author_feed_link() 1171 * @see get_author_feed_link() 1172 * 1173 * @param bool $echo 1174 * @param int $author_id 1175 * @return string 1176 */ 1177function get_author_rss_link($echo = false, $author_id = 1) { 1178 _deprecated_function( __FUNCTION__, '2.5.0', 'get_author_feed_link()' ); 1179 1180 $link = get_author_feed_link($author_id); 1181 if ( $echo ) 1182 echo $link; 1183 return $link; 1184} 1185 1186/** 1187 * Return link to the post RSS feed. 1188 * 1189 * @since 1.5.0 1190 * @deprecated 2.2.0 Use get_post_comments_feed_link() 1191 * @see get_post_comments_feed_link() 1192 * 1193 * @return string 1194 */ 1195function comments_rss() { 1196 _deprecated_function( __FUNCTION__, '2.2.0', 'get_post_comments_feed_link()' ); 1197 return esc_url( get_post_comments_feed_link() ); 1198} 1199 1200/** 1201 * An alias of wp_create_user(). 1202 * 1203 * @since 2.0.0 1204 * @deprecated 2.0.0 Use wp_create_user() 1205 * @see wp_create_user() 1206 * 1207 * @param string $username The user's username. 1208 * @param string $password The user's password. 1209 * @param string $email The user's email. 1210 * @return int The new user's ID. 1211 */ 1212function create_user($username, $password, $email) { 1213 _deprecated_function( __FUNCTION__, '2.0.0', 'wp_create_user()' ); 1214 return wp_create_user($username, $password, $email); 1215} 1216 1217/** 1218 * Unused function. 1219 * 1220 * @deprecated 2.5.0 1221 */ 1222function gzip_compression() { 1223 _deprecated_function( __FUNCTION__, '2.5.0' ); 1224 return false; 1225} 1226 1227/** 1228 * Retrieve an array of comment data about comment $comment_ID. 1229 * 1230 * @since 0.71 1231 * @deprecated 2.7.0 Use get_comment() 1232 * @see get_comment() 1233 * 1234 * @param int $comment_ID The ID of the comment 1235 * @param int $no_cache Whether to use the cache (cast to bool) 1236 * @param bool $include_unapproved Whether to include unapproved comments 1237 * @return array The comment data 1238 */ 1239function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) { 1240 _deprecated_function( __FUNCTION__, '2.7.0', 'get_comment()' ); 1241 return get_comment($comment_ID, ARRAY_A); 1242} 1243 1244/** 1245 * Retrieve the category name by the category ID. 1246 * 1247 * @since 0.71 1248 * @deprecated 2.8.0 Use get_cat_name() 1249 * @see get_cat_name() 1250 * 1251 * @param int $cat_ID Category ID 1252 * @return string category name 1253 */ 1254function get_catname( $cat_ID ) { 1255 _deprecated_function( __FUNCTION__, '2.8.0', 'get_cat_name()' ); 1256 return get_cat_name( $cat_ID ); 1257} 1258 1259/** 1260 * Retrieve category children list separated before and after the term IDs. 1261 * 1262 * @since 1.2.0 1263 * @deprecated 2.8.0 Use get_term_children() 1264 * @see get_term_children() 1265 * 1266 * @param int $id Category ID to retrieve children. 1267 * @param string $before Optional. Prepend before category term ID. Default '/'. 1268 * @param string $after Optional. Append after category term ID. Default empty string. 1269 * @param array $visited Optional. Category Term IDs that have already been added. 1270 * Default empty array. 1271 * @return string 1272 */ 1273function get_category_children( $id, $before = '/', $after = '', $visited = array() ) { 1274 _deprecated_function( __FUNCTION__, '2.8.0', 'get_term_children()' ); 1275 if ( 0 == $id ) 1276 return ''; 1277 1278 $chain = ''; 1279 /** TODO: Consult hierarchy */ 1280 $cat_ids = get_all_category_ids(); 1281 foreach ( (array) $cat_ids as $cat_id ) { 1282 if ( $cat_id == $id ) 1283 continue; 1284 1285 $category = get_category( $cat_id ); 1286 if ( is_wp_error( $category ) ) 1287 return $category; 1288 if ( $category->parent == $id && !in_array( $category->term_id, $visited ) ) { 1289 $visited[] = $category->term_id; 1290 $chain .= $before.$category->term_id.$after; 1291 $chain .= get_category_children( $category->term_id, $before, $after ); 1292 } 1293 } 1294 return $chain; 1295} 1296 1297/** 1298 * Retrieves all category IDs. 1299 * 1300 * @since 2.0.0 1301 * @deprecated 4.0.0 Use get_terms() 1302 * @see get_terms() 1303 * 1304 * @link https://developer.wordpress.org/reference/functions/get_all_category_ids/ 1305 * 1306 * @return int[] List of all of the category IDs. 1307 */ 1308function get_all_category_ids() { 1309 _deprecated_function( __FUNCTION__, '4.0.0', 'get_terms()' ); 1310 1311 $cat_ids = get_terms( 1312 array( 1313 'taxonomy' => 'category', 1314 'fields' => 'ids', 1315 'get' => 'all', 1316 ) 1317 ); 1318 1319 return $cat_ids; 1320} 1321 1322/** 1323 * Retrieve the description of the author of the current post. 1324 * 1325 * @since 1.5.0 1326 * @deprecated 2.8.0 Use get_the_author_meta() 1327 * @see get_the_author_meta() 1328 * 1329 * @return string The author's description. 1330 */ 1331function get_the_author_description() { 1332 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'description\')' ); 1333 return get_the_author_meta('description'); 1334} 1335 1336/** 1337 * Display the description of the author of the current post. 1338 * 1339 * @since 1.0.0 1340 * @deprecated 2.8.0 Use the_author_meta() 1341 * @see the_author_meta() 1342 */ 1343function the_author_description() { 1344 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'description\')' ); 1345 the_author_meta('description'); 1346} 1347 1348/** 1349 * Retrieve the login name of the author of the current post. 1350 * 1351 * @since 1.5.0 1352 * @deprecated 2.8.0 Use get_the_author_meta() 1353 * @see get_the_author_meta() 1354 * 1355 * @return string The author's login name (username). 1356 */ 1357function get_the_author_login() { 1358 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'login\')' ); 1359 return get_the_author_meta('login'); 1360} 1361 1362/** 1363 * Display the login name of the author of the current post. 1364 * 1365 * @since 0.71 1366 * @deprecated 2.8.0 Use the_author_meta() 1367 * @see the_author_meta() 1368 */ 1369function the_author_login() { 1370 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'login\')' ); 1371 the_author_meta('login'); 1372} 1373 1374/** 1375 * Retrieve the first name of the author of the current post. 1376 * 1377 * @since 1.5.0 1378 * @deprecated 2.8.0 Use get_the_author_meta() 1379 * @see get_the_author_meta() 1380 * 1381 * @return string The author's first name. 1382 */ 1383function get_the_author_firstname() { 1384 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'first_name\')' ); 1385 return get_the_author_meta('first_name'); 1386} 1387 1388/** 1389 * Display the first name of the author of the current post. 1390 * 1391 * @since 0.71 1392 * @deprecated 2.8.0 Use the_author_meta() 1393 * @see the_author_meta() 1394 */ 1395function the_author_firstname() { 1396 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'first_name\')' ); 1397 the_author_meta('first_name'); 1398} 1399 1400/** 1401 * Retrieve the last name of the author of the current post. 1402 * 1403 * @since 1.5.0 1404 * @deprecated 2.8.0 Use get_the_author_meta() 1405 * @see get_the_author_meta() 1406 * 1407 * @return string The author's last name. 1408 */ 1409function get_the_author_lastname() { 1410 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'last_name\')' ); 1411 return get_the_author_meta('last_name'); 1412} 1413 1414/** 1415 * Display the last name of the author of the current post. 1416 * 1417 * @since 0.71 1418 * @deprecated 2.8.0 Use the_author_meta() 1419 * @see the_author_meta() 1420 */ 1421function the_author_lastname() { 1422 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'last_name\')' ); 1423 the_author_meta('last_name'); 1424} 1425 1426/** 1427 * Retrieve the nickname of the author of the current post. 1428 * 1429 * @since 1.5.0 1430 * @deprecated 2.8.0 Use get_the_author_meta() 1431 * @see get_the_author_meta() 1432 * 1433 * @return string The author's nickname. 1434 */ 1435function get_the_author_nickname() { 1436 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'nickname\')' ); 1437 return get_the_author_meta('nickname'); 1438} 1439 1440/** 1441 * Display the nickname of the author of the current post. 1442 * 1443 * @since 0.71 1444 * @deprecated 2.8.0 Use the_author_meta() 1445 * @see the_author_meta() 1446 */ 1447function the_author_nickname() { 1448 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'nickname\')' ); 1449 the_author_meta('nickname'); 1450} 1451 1452/** 1453 * Retrieve the email of the author of the current post. 1454 * 1455 * @since 1.5.0 1456 * @deprecated 2.8.0 Use get_the_author_meta() 1457 * @see get_the_author_meta() 1458 * 1459 * @return string The author's username. 1460 */ 1461function get_the_author_email() { 1462 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'email\')' ); 1463 return get_the_author_meta('email'); 1464} 1465 1466/** 1467 * Display the email of the author of the current post. 1468 * 1469 * @since 0.71 1470 * @deprecated 2.8.0 Use the_author_meta() 1471 * @see the_author_meta() 1472 */ 1473function the_author_email() { 1474 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'email\')' ); 1475 the_author_meta('email'); 1476} 1477 1478/** 1479 * Retrieve the ICQ number of the author of the current post. 1480 * 1481 * @since 1.5.0 1482 * @deprecated 2.8.0 Use get_the_author_meta() 1483 * @see get_the_author_meta() 1484 * 1485 * @return string The author's ICQ number. 1486 */ 1487function get_the_author_icq() { 1488 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'icq\')' ); 1489 return get_the_author_meta('icq'); 1490} 1491 1492/** 1493 * Display the ICQ number of the author of the current post. 1494 * 1495 * @since 0.71 1496 * @deprecated 2.8.0 Use the_author_meta() 1497 * @see the_author_meta() 1498 */ 1499function the_author_icq() { 1500 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'icq\')' ); 1501 the_author_meta('icq'); 1502} 1503 1504/** 1505 * Retrieve the Yahoo! IM name of the author of the current post. 1506 * 1507 * @since 1.5.0 1508 * @deprecated 2.8.0 Use get_the_author_meta() 1509 * @see get_the_author_meta() 1510 * 1511 * @return string The author's Yahoo! IM name. 1512 */ 1513function get_the_author_yim() { 1514 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'yim\')' ); 1515 return get_the_author_meta('yim'); 1516} 1517 1518/** 1519 * Display the Yahoo! IM name of the author of the current post. 1520 * 1521 * @since 0.71 1522 * @deprecated 2.8.0 Use the_author_meta() 1523 * @see the_author_meta() 1524 */ 1525function the_author_yim() { 1526 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'yim\')' ); 1527 the_author_meta('yim'); 1528} 1529 1530/** 1531 * Retrieve the MSN address of the author of the current post. 1532 * 1533 * @since 1.5.0 1534 * @deprecated 2.8.0 Use get_the_author_meta() 1535 * @see get_the_author_meta() 1536 * 1537 * @return string The author's MSN address. 1538 */ 1539function get_the_author_msn() { 1540 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'msn\')' ); 1541 return get_the_author_meta('msn'); 1542} 1543 1544/** 1545 * Display the MSN address of the author of the current post. 1546 * 1547 * @since 0.71 1548 * @deprecated 2.8.0 Use the_author_meta() 1549 * @see the_author_meta() 1550 */ 1551function the_author_msn() { 1552 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'msn\')' ); 1553 the_author_meta('msn'); 1554} 1555 1556/** 1557 * Retrieve the AIM address of the author of the current post. 1558 * 1559 * @since 1.5.0 1560 * @deprecated 2.8.0 Use get_the_author_meta() 1561 * @see get_the_author_meta() 1562 * 1563 * @return string The author's AIM address. 1564 */ 1565function get_the_author_aim() { 1566 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'aim\')' ); 1567 return get_the_author_meta('aim'); 1568} 1569 1570/** 1571 * Display the AIM address of the author of the current post. 1572 * 1573 * @since 0.71 1574 * @deprecated 2.8.0 Use the_author_meta('aim') 1575 * @see the_author_meta() 1576 */ 1577function the_author_aim() { 1578 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'aim\')' ); 1579 the_author_meta('aim'); 1580} 1581 1582/** 1583 * Retrieve the specified author's preferred display name. 1584 * 1585 * @since 1.0.0 1586 * @deprecated 2.8.0 Use get_the_author_meta() 1587 * @see get_the_author_meta() 1588 * 1589 * @param int $auth_id The ID of the author. 1590 * @return string The author's display name. 1591 */ 1592function get_author_name( $auth_id = false ) { 1593 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'display_name\')' ); 1594 return get_the_author_meta('display_name', $auth_id); 1595} 1596 1597/** 1598 * Retrieve the URL to the home page of the author of the current post. 1599 * 1600 * @since 1.5.0 1601 * @deprecated 2.8.0 Use get_the_author_meta() 1602 * @see get_the_author_meta() 1603 * 1604 * @return string The URL to the author's page. 1605 */ 1606function get_the_author_url() { 1607 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'url\')' ); 1608 return get_the_author_meta('url'); 1609} 1610 1611/** 1612 * Display the URL to the home page of the author of the current post. 1613 * 1614 * @since 0.71 1615 * @deprecated 2.8.0 Use the_author_meta() 1616 * @see the_author_meta() 1617 */ 1618function the_author_url() { 1619 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'url\')' ); 1620 the_author_meta('url'); 1621} 1622 1623/** 1624 * Retrieve the ID of the author of the current post. 1625 * 1626 * @since 1.5.0 1627 * @deprecated 2.8.0 Use get_the_author_meta() 1628 * @see get_the_author_meta() 1629 * 1630 * @return string|int The author's ID. 1631 */ 1632function get_the_author_ID() { 1633 _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'ID\')' ); 1634 return get_the_author_meta('ID'); 1635} 1636 1637/** 1638 * Display the ID of the author of the current post. 1639 * 1640 * @since 0.71 1641 * @deprecated 2.8.0 Use the_author_meta() 1642 * @see the_author_meta() 1643 */ 1644function the_author_ID() { 1645 _deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'ID\')' ); 1646 the_author_meta('ID'); 1647} 1648 1649/** 1650 * Display the post content for the feed. 1651 * 1652 * For encoding the HTML or the $encode_html parameter, there are three possible values: 1653 * - '0' will make urls footnotes and use make_url_footnote(). 1654 * - '1' will encode special characters and automatically display all of the content. 1655 * - '2' will strip all HTML tags from the content. 1656 * 1657 * Also note that you cannot set the amount of words and not set the HTML encoding. 1658 * If that is the case, then the HTML encoding will default to 2, which will strip 1659 * all HTML tags. 1660 * 1661 * To restrict the amount of words of the content, you can use the cut parameter. 1662 * If the content is less than the amount, then there won't be any dots added to the end. 1663 * If there is content left over, then dots will be added and the rest of the content 1664 * will be removed. 1665 * 1666 * @since 0.71 1667 * 1668 * @deprecated 2.9.0 Use the_content_feed() 1669 * @see the_content_feed() 1670 * 1671 * @param string $more_link_text Optional. Text to display when more content is available 1672 * but not displayed. Default '(more...)'. 1673 * @param int $stripteaser Optional. Default 0. 1674 * @param string $more_file Optional. 1675 * @param int $cut Optional. Amount of words to keep for the content. 1676 * @param int $encode_html Optional. How to encode the content. 1677 */ 1678function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) { 1679 _deprecated_function( __FUNCTION__, '2.9.0', 'the_content_feed()' ); 1680 $content = get_the_content($more_link_text, $stripteaser); 1681 1682 /** 1683 * Filters the post content in the context of an RSS feed. 1684 * 1685 * @since 0.71 1686 * 1687 * @param string $content Content of the current post. 1688 */ 1689 $content = apply_filters('the_content_rss', $content); 1690 if ( $cut && !$encode_html ) 1691 $encode_html = 2; 1692 if ( 1== $encode_html ) { 1693 $content = esc_html($content); 1694 $cut = 0; 1695 } elseif ( 0 == $encode_html ) { 1696 $content = make_url_footnote($content); 1697 } elseif ( 2 == $encode_html ) { 1698 $content = strip_tags($content); 1699 } 1700 if ( $cut ) { 1701 $blah = explode(' ', $content); 1702 if ( count($blah) > $cut ) { 1703 $k = $cut; 1704 $use_dotdotdot = 1; 1705 } else { 1706 $k = count($blah); 1707 $use_dotdotdot = 0; 1708 } 1709 1710 /** @todo Check performance, might be faster to use array slice instead. */ 1711 for ( $i=0; $i<$k; $i++ ) 1712 $excerpt .= $blah[$i].' '; 1713 $excerpt .= ($use_dotdotdot) ? '...' : ''; 1714 $content = $excerpt; 1715 } 1716 $content = str_replace(']]>', ']]>', $content); 1717 echo $content; 1718} 1719 1720/** 1721 * Strip HTML and put links at the bottom of stripped content. 1722 * 1723 * Searches for all of the links, strips them out of the content, and places 1724 * them at the bottom of the content with numbers. 1725 * 1726 * @since 0.71 1727 * @deprecated 2.9.0 1728 * 1729 * @param string $content Content to get links. 1730 * @return string HTML stripped out of content with links at the bottom. 1731 */ 1732function make_url_footnote( $content ) { 1733 _deprecated_function( __FUNCTION__, '2.9.0', '' ); 1734 preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches ); 1735 $links_summary = "\n"; 1736 for ( $i = 0, $c = count( $matches[0] ); $i < $c; $i++ ) { 1737 $link_match = $matches[0][$i]; 1738 $link_number = '['.($i+1).']'; 1739 $link_url = $matches[2][$i]; 1740 $link_text = $matches[4][$i]; 1741 $content = str_replace( $link_match, $link_text . ' ' . $link_number, $content ); 1742 $link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url; 1743 $links_summary .= "\n" . $link_number . ' ' . $link_url; 1744 } 1745 $content = strip_tags( $content ); 1746 $content .= $links_summary; 1747 return $content; 1748} 1749 1750/** 1751 * Retrieve translated string with vertical bar context 1752 * 1753 * Quite a few times, there will be collisions with similar translatable text 1754 * found in more than two places but with different translated context. 1755 * 1756 * In order to use the separate contexts, the _c() function is used and the 1757 * translatable string uses a pipe ('|') which has the context the string is in. 1758 * 1759 * When the translated string is returned, it is everything before the pipe, not 1760 * including the pipe character. If there is no pipe in the translated text then 1761 * everything is returned. 1762 * 1763 * @since 2.2.0 1764 * @deprecated 2.9.0 Use _x() 1765 * @see _x() 1766 * 1767 * @param string $text Text to translate. 1768 * @param string $domain Optional. Domain to retrieve the translated text. 1769 * @return string Translated context string without pipe. 1770 */ 1771function _c( $text, $domain = 'default' ) { 1772 _deprecated_function( __FUNCTION__, '2.9.0', '_x()' ); 1773 return before_last_bar( translate( $text, $domain ) ); 1774} 1775 1776/** 1777 * Translates $text like translate(), but assumes that the text 1778 * contains a context after its last vertical bar. 1779 * 1780 * @since 2.5.0 1781 * @deprecated 3.0.0 Use _x() 1782 * @see _x() 1783 * 1784 * @param string $text Text to translate. 1785 * @param string $domain Domain to retrieve the translated text. 1786 * @return string Translated text. 1787 */ 1788function translate_with_context( $text, $domain = 'default' ) { 1789 _deprecated_function( __FUNCTION__, '2.9.0', '_x()' ); 1790 return before_last_bar( translate( $text, $domain ) ); 1791} 1792 1793/** 1794 * Legacy version of _n(), which supports contexts. 1795 * 1796 * Strips everything from the translation after the last bar. 1797 * 1798 * @since 2.7.0 1799 * @deprecated 3.0.0 Use _nx() 1800 * @see _nx() 1801 * 1802 * @param string $single The text to be used if the number is singular. 1803 * @param string $plural The text to be used if the number is plural. 1804 * @param int $number The number to compare against to use either the singular or plural form. 1805 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. 1806 * Default 'default'. 1807 * @return string The translated singular or plural form. 1808 */ 1809function _nc( $single, $plural, $number, $domain = 'default' ) { 1810 _deprecated_function( __FUNCTION__, '2.9.0', '_nx()' ); 1811 return before_last_bar( _n( $single, $plural, $number, $domain ) ); 1812} 1813 1814/** 1815 * Retrieve the plural or single form based on the amount. 1816 * 1817 * @since 1.2.0 1818 * @deprecated 2.8.0 Use _n() 1819 * @see _n() 1820 */ 1821function __ngettext( ...$args ) { // phpcs:ignore PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore 1822 _deprecated_function( __FUNCTION__, '2.8.0', '_n()' ); 1823 return _n( ...$args ); 1824} 1825 1826/** 1827 * Register plural strings in POT file, but don't translate them. 1828 * 1829 * @since 2.5.0 1830 * @deprecated 2.8.0 Use _n_noop() 1831 * @see _n_noop() 1832 */ 1833function __ngettext_noop( ...$args ) { // phpcs:ignore PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore 1834 _deprecated_function( __FUNCTION__, '2.8.0', '_n_noop()' ); 1835 return _n_noop( ...$args ); 1836 1837} 1838 1839/** 1840 * Retrieve all autoload options, or all options if no autoloaded ones exist. 1841 * 1842 * @since 1.0.0 1843 * @deprecated 3.0.0 Use wp_load_alloptions()) 1844 * @see wp_load_alloptions() 1845 * 1846 * @return array List of all options. 1847 */ 1848function get_alloptions() { 1849 _deprecated_function( __FUNCTION__, '3.0.0', 'wp_load_alloptions()' ); 1850 return wp_load_alloptions(); 1851} 1852 1853/** 1854 * Retrieve HTML content of attachment image with link. 1855 * 1856 * @since 2.0.0 1857 * @deprecated 2.5.0 Use wp_get_attachment_link() 1858 * @see wp_get_attachment_link() 1859 * 1860 * @param int $id Optional. Post ID. 1861 * @param bool $fullsize Optional. Whether to use full size image. Default false. 1862 * @param array $max_dims Optional. Max image dimensions. 1863 * @param bool $permalink Optional. Whether to include permalink to image. Default false. 1864 * @return string 1865 */ 1866function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) { 1867 _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_link()' ); 1868 $id = (int) $id; 1869 $_post = get_post($id); 1870 1871 if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) ) 1872 return __('Missing Attachment'); 1873 1874 if ( $permalink ) 1875 $url = get_attachment_link($_post->ID); 1876 1877 $post_title = esc_attr($_post->post_title); 1878 1879 $innerHTML = get_attachment_innerHTML($_post->ID, $fullsize, $max_dims); 1880 return "<a href='$url' title='$post_title'>$innerHTML</a>"; 1881} 1882 1883/** 1884 * Retrieve icon URL and Path. 1885 * 1886 * @since 2.1.0 1887 * @deprecated 2.5.0 Use wp_get_attachment_image_src() 1888 * @see wp_get_attachment_image_src() 1889 * 1890 * @param int $id Optional. Post ID. 1891 * @param bool $fullsize Optional. Whether to have full image. Default false. 1892 * @return array Icon URL and full path to file, respectively. 1893 */ 1894function get_attachment_icon_src( $id = 0, $fullsize = false ) { 1895 _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image_src()' ); 1896 $id = (int) $id; 1897 if ( !$post = get_post($id) ) 1898 return false; 1899 1900 $file = get_attached_file( $post->ID ); 1901 1902 if ( !$fullsize && $src = wp_get_attachment_thumb_url( $post->ID ) ) { 1903 // We have a thumbnail desired, specified and existing. 1904 1905 $src_file = wp_basename($src); 1906 } elseif ( wp_attachment_is_image( $post->ID ) ) { 1907 // We have an image without a thumbnail. 1908 1909 $src = wp_get_attachment_url( $post->ID ); 1910 $src_file = & $file; 1911 } elseif ( $src = wp_mime_type_icon( $post->ID ) ) { 1912 // No thumb, no image. We'll look for a mime-related icon instead. 1913 1914 /** This filter is documented in wp-includes/post.php */ 1915 $icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' ); 1916 $src_file = $icon_dir . '/' . wp_basename($src); 1917 } 1918 1919 if ( !isset($src) || !$src ) 1920 return false; 1921 1922 return array($src, $src_file); 1923} 1924 1925/** 1926 * Retrieve HTML content of icon attachment image element. 1927 * 1928 * @since 2.0.0 1929 * @deprecated 2.5.0 Use wp_get_attachment_image() 1930 * @see wp_get_attachment_image() 1931 * 1932 * @param int $id Optional. Post ID. 1933 * @param bool $fullsize Optional. Whether to have full size image. Default false. 1934 * @param array $max_dims Optional. Dimensions of image. 1935 * @return string|false HTML content. 1936 */ 1937function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) { 1938 _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' ); 1939 $id = (int) $id; 1940 if ( !$post = get_post($id) ) 1941 return false; 1942 1943 if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) ) 1944 return false; 1945 1946 list($src, $src_file) = $src; 1947 1948 // Do we need to constrain the image? 1949 if ( ($max_dims = apply_filters('attachment_max_dims', $max_dims)) && file_exists($src_file) ) { 1950 1951 $imagesize = wp_getimagesize($src_file); 1952 1953 if (($imagesize[0] > $max_dims[0]) || $imagesize[1] > $max_dims[1] ) { 1954 $actual_aspect = $imagesize[0] / $imagesize[1]; 1955 $desired_aspect = $max_dims[0] / $max_dims[1]; 1956 1957 if ( $actual_aspect >= $desired_aspect ) { 1958 $height = $actual_aspect * $max_dims[0]; 1959 $constraint = "width='{$max_dims[0]}' "; 1960 $post->iconsize = array($max_dims[0], $height); 1961 } else { 1962 $width = $max_dims[1] / $actual_aspect; 1963 $constraint = "height='{$max_dims[1]}' "; 1964 $post->iconsize = array($width, $max_dims[1]); 1965 } 1966 } else { 1967 $post->iconsize = array($imagesize[0], $imagesize[1]); 1968 $constraint = ''; 1969 } 1970 } else { 1971 $constraint = ''; 1972 } 1973 1974 $post_title = esc_attr($post->post_title); 1975 1976 $icon = "<img src='$src' title='$post_title' alt='$post_title' $constraint/>"; 1977 1978 return apply_filters( 'attachment_icon', $icon, $post->ID ); 1979} 1980 1981/** 1982 * Retrieve HTML content of image element. 1983 * 1984 * @since 2.0.0 1985 * @deprecated 2.5.0 Use wp_get_attachment_image() 1986 * @see wp_get_attachment_image() 1987 * 1988 * @param int $id Optional. Post ID. 1989 * @param bool $fullsize Optional. Whether to have full size image. Default false. 1990 * @param array $max_dims Optional. Dimensions of image. 1991 * @return string|false 1992 */ 1993function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) { 1994 _deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' ); 1995 $id = (int) $id; 1996 if ( !$post = get_post($id) ) 1997 return false; 1998 1999 if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims)) 2000 return $innerHTML; 2001 2002 $innerHTML = esc_attr($post->post_title); 2003 2004 return apply_filters('attachment_innerHTML', $innerHTML, $post->ID); 2005} 2006 2007/** 2008 * Retrieves bookmark data based on ID. 2009 * 2010 * @since 2.0.0 2011 * @deprecated 2.1.0 Use get_bookmark() 2012 * @see get_bookmark() 2013 * 2014 * @param int $bookmark_id ID of link 2015 * @param string $output Optional. Type of output. Accepts OBJECT, ARRAY_N, or ARRAY_A. 2016 * Default OBJECT. 2017 * @param string $filter Optional. How to filter the link for output. Accepts 'raw', 'edit', 2018 * 'attribute', 'js', 'db', or 'display'. Default 'raw'. 2019 * @return object|array Bookmark object or array, depending on the type specified by `$output`. 2020 */ 2021function get_link( $bookmark_id, $output = OBJECT, $filter = 'raw' ) { 2022 _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmark()' ); 2023 return get_bookmark($bookmark_id, $output, $filter); 2024} 2025 2026/** 2027 * Performs esc_url() for database or redirect usage. 2028 * 2029 * @since 2.3.1 2030 * @deprecated 2.8.0 Use esc_url_raw() 2031 * @see esc_url_raw() 2032 * 2033 * @param string $url The URL to be cleaned. 2034 * @param array $protocols An array of acceptable protocols. 2035 * @return string The cleaned URL. 2036 */ 2037function sanitize_url( $url, $protocols = null ) { 2038 _deprecated_function( __FUNCTION__, '2.8.0', 'esc_url_raw()' ); 2039 return esc_url_raw( $url, $protocols ); 2040} 2041 2042/** 2043 * Checks and cleans a URL. 2044 * 2045 * A number of characters are removed from the URL. If the URL is for displaying 2046 * (the default behaviour) ampersands are also replaced. The 'clean_url' filter 2047 * is applied to the returned cleaned URL. 2048 * 2049 * @since 1.2.0 2050 * @deprecated 3.0.0 Use esc_url() 2051 * @see esc_url() 2052 * 2053 * @param string $url The URL to be cleaned. 2054 * @param array $protocols Optional. An array of acceptable protocols. 2055 * @param string $context Optional. How the URL will be used. Default is 'display'. 2056 * @return string The cleaned $url after the {@see 'clean_url'} filter is applied. 2057 */ 2058function clean_url( $url, $protocols = null, $context = 'display' ) { 2059 if ( $context == 'db' ) 2060 _deprecated_function( 'clean_url( $context = \'db\' )', '3.0.0', 'esc_url_raw()' ); 2061 else 2062 _deprecated_function( __FUNCTION__, '3.0.0', 'esc_url()' ); 2063 return esc_url( $url, $protocols, $context ); 2064} 2065 2066/** 2067 * Escape single quotes, specialchar double quotes, and fix line endings. 2068 * 2069 * The filter {@see 'js_escape'} is also applied by esc_js(). 2070 * 2071 * @since 2.0.4 2072 * @deprecated 2.8.0 Use esc_js() 2073 * @see esc_js() 2074 * 2075 * @param string $text The text to be escaped. 2076 * @return string Escaped text. 2077 */ 2078function js_escape( $text ) { 2079 _deprecated_function( __FUNCTION__, '2.8.0', 'esc_js()' ); 2080 return esc_js( $text ); 2081} 2082 2083/** 2084 * Legacy escaping for HTML blocks. 2085 * 2086 * @deprecated 2.8.0 Use esc_html() 2087 * @see esc_html() 2088 * 2089 * @param string $string String to escape. 2090 * @param string $quote_style Unused. 2091 * @param false|string $charset Unused. 2092 * @param false $double_encode Whether to double encode. Unused. 2093 * @return string Escaped `$string`. 2094 */ 2095function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) { 2096 _deprecated_function( __FUNCTION__, '2.8.0', 'esc_html()' ); 2097 if ( func_num_args() > 1 ) { // Maintain back-compat for people passing additional arguments. 2098 return _wp_specialchars( $string, $quote_style, $charset, $double_encode ); 2099 } else { 2100 return esc_html( $string ); 2101 } 2102} 2103 2104/** 2105 * Escaping for HTML attributes. 2106 * 2107 * @since 2.0.6 2108 * @deprecated 2.8.0 Use esc_attr() 2109 * @see esc_attr() 2110 * 2111 * @param string $text 2112 * @return string 2113 */ 2114function attribute_escape( $text ) { 2115 _deprecated_function( __FUNCTION__, '2.8.0', 'esc_attr()' ); 2116 return esc_attr( $text ); 2117} 2118 2119/** 2120 * Register widget for sidebar with backward compatibility. 2121 * 2122 * Allows $name to be an array that accepts either three elements to grab the 2123 * first element and the third for the name or just uses the first element of 2124 * the array for the name. 2125 * 2126 * Passes to wp_register_sidebar_widget() after argument list and backward 2127 * compatibility is complete. 2128 * 2129 * @since 2.2.0 2130 * @deprecated 2.8.0 Use wp_register_sidebar_widget() 2131 * @see wp_register_sidebar_widget() 2132 * 2133 * @param string|int $name Widget ID. 2134 * @param callable $output_callback Run when widget is called. 2135 * @param string $classname Optional. Classname widget option. Default empty. 2136 * @param mixed ...$params Widget parameters. 2137 */ 2138function register_sidebar_widget($name, $output_callback, $classname = '', ...$params) { 2139 _deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_sidebar_widget()' ); 2140 // Compat. 2141 if ( is_array( $name ) ) { 2142 if ( count( $name ) === 3 ) { 2143 $name = sprintf( $name[0], $name[2] ); 2144 } else { 2145 $name = $name[0]; 2146 } 2147 } 2148 2149 $id = sanitize_title( $name ); 2150 $options = array(); 2151 if ( ! empty( $classname ) && is_string( $classname ) ) { 2152 $options['classname'] = $classname; 2153 } 2154 2155 wp_register_sidebar_widget( $id, $name, $output_callback, $options, ...$params ); 2156} 2157 2158/** 2159 * Serves as an alias of wp_unregister_sidebar_widget(). 2160 * 2161 * @since 2.2.0 2162 * @deprecated 2.8.0 Use wp_unregister_sidebar_widget() 2163 * @see wp_unregister_sidebar_widget() 2164 * 2165 * @param int|string $id Widget ID. 2166 */ 2167function unregister_sidebar_widget($id) { 2168 _deprecated_function( __FUNCTION__, '2.8.0', 'wp_unregister_sidebar_widget()' ); 2169 return wp_unregister_sidebar_widget($id); 2170} 2171 2172/** 2173 * Registers widget control callback for customizing options. 2174 * 2175 * Allows $name to be an array that accepts either three elements to grab the 2176 * first element and the third for the name or just uses the first element of 2177 * the array for the name. 2178 * 2179 * Passes to wp_register_widget_control() after the argument list has 2180 * been compiled. 2181 * 2182 * @since 2.2.0 2183 * @deprecated 2.8.0 Use wp_register_widget_control() 2184 * @see wp_register_widget_control() 2185 * 2186 * @param int|string $name Sidebar ID. 2187 * @param callable $control_callback Widget control callback to display and process form. 2188 * @param int $width Widget width. 2189 * @param int $height Widget height. 2190 * @param mixed ...$params Widget parameters. 2191 */ 2192function register_widget_control($name, $control_callback, $width = '', $height = '', ...$params) { 2193 _deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_widget_control()' ); 2194 // Compat. 2195 if ( is_array( $name ) ) { 2196 if ( count( $name ) === 3 ) { 2197 $name = sprintf( $name[0], $name[2] ); 2198 } else { 2199 $name = $name[0]; 2200 } 2201 } 2202 2203 $id = sanitize_title( $name ); 2204 $options = array(); 2205 if ( ! empty( $width ) ) { 2206 $options['width'] = $width; 2207 } 2208 if ( ! empty( $height ) ) { 2209 $options['height'] = $height; 2210 } 2211 2212 wp_register_widget_control( $id, $name, $control_callback, $options, ...$params ); 2213} 2214 2215/** 2216 * Alias of wp_unregister_widget_control(). 2217 * 2218 * @since 2.2.0 2219 * @deprecated 2.8.0 Use wp_unregister_widget_control() 2220 * @see wp_unregister_widget_control() 2221 * 2222 * @param int|string $id Widget ID. 2223 */ 2224function unregister_widget_control($id) { 2225 _deprecated_function( __FUNCTION__, '2.8.0', 'wp_unregister_widget_control()' ); 2226 return wp_unregister_widget_control($id); 2227} 2228 2229/** 2230 * Remove user meta data. 2231 * 2232 * @since 2.0.0 2233 * @deprecated 3.0.0 Use delete_user_meta() 2234 * @see delete_user_meta() 2235 * 2236 * @param int $user_id User ID. 2237 * @param string $meta_key Metadata key. 2238 * @param mixed $meta_value Optional. Metadata value. Default empty. 2239 * @return bool True deletion completed and false if user_id is not a number. 2240 */ 2241function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) { 2242 _deprecated_function( __FUNCTION__, '3.0.0', 'delete_user_meta()' ); 2243 global $wpdb; 2244 if ( !is_numeric( $user_id ) ) 2245 return false; 2246 $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); 2247 2248 if ( is_array($meta_value) || is_object($meta_value) ) 2249 $meta_value = serialize($meta_value); 2250 $meta_value = trim( $meta_value ); 2251 2252 $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); 2253 2254 if ( $cur && $cur->umeta_id ) 2255 do_action( 'delete_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); 2256 2257 if ( ! empty($meta_value) ) 2258 $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) ); 2259 else 2260 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); 2261 2262 clean_user_cache( $user_id ); 2263 wp_cache_delete( $user_id, 'user_meta' ); 2264 2265 if ( $cur && $cur->umeta_id ) 2266 do_action( 'deleted_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); 2267 2268 return true; 2269} 2270 2271/** 2272 * Retrieve user metadata. 2273 * 2274 * If $user_id is not a number, then the function will fail over with a 'false' 2275 * boolean return value. Other returned values depend on whether there is only 2276 * one item to be returned, which be that single item type. If there is more 2277 * than one metadata value, then it will be list of metadata values. 2278 * 2279 * @since 2.0.0 2280 * @deprecated 3.0.0 Use get_user_meta() 2281 * @see get_user_meta() 2282 * 2283 * @param int $user_id User ID 2284 * @param string $meta_key Optional. Metadata key. Default empty. 2285 * @return mixed 2286 */ 2287function get_usermeta( $user_id, $meta_key = '' ) { 2288 _deprecated_function( __FUNCTION__, '3.0.0', 'get_user_meta()' ); 2289 global $wpdb; 2290 $user_id = (int) $user_id; 2291 2292 if ( !$user_id ) 2293 return false; 2294 2295 if ( !empty($meta_key) ) { 2296 $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); 2297 $user = wp_cache_get($user_id, 'users'); 2298 // Check the cached user object. 2299 if ( false !== $user && isset($user->$meta_key) ) 2300 $metas = array($user->$meta_key); 2301 else 2302 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); 2303 } else { 2304 $metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d", $user_id) ); 2305 } 2306 2307 if ( empty($metas) ) { 2308 if ( empty($meta_key) ) 2309 return array(); 2310 else 2311 return ''; 2312 } 2313 2314 $metas = array_map('maybe_unserialize', $metas); 2315 2316 if ( count($metas) == 1 ) 2317 return $metas[0]; 2318 else 2319 return $metas; 2320} 2321 2322/** 2323 * Update metadata of user. 2324 * 2325 * There is no need to serialize values, they will be serialized if it is 2326 * needed. The metadata key can only be a string with underscores. All else will 2327 * be removed. 2328 * 2329 * Will remove the metadata, if the meta value is empty. 2330 * 2331 * @since 2.0.0 2332 * @deprecated 3.0.0 Use update_user_meta() 2333 * @see update_user_meta() 2334 * 2335 * @param int $user_id User ID 2336 * @param string $meta_key Metadata key. 2337 * @param mixed $meta_value Metadata value. 2338 * @return bool True on successful update, false on failure. 2339 */ 2340function update_usermeta( $user_id, $meta_key, $meta_value ) { 2341 _deprecated_function( __FUNCTION__, '3.0.0', 'update_user_meta()' ); 2342 global $wpdb; 2343 if ( !is_numeric( $user_id ) ) 2344 return false; 2345 $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key); 2346 2347 /** @todo Might need fix because usermeta data is assumed to be already escaped */ 2348 if ( is_string($meta_value) ) 2349 $meta_value = stripslashes($meta_value); 2350 $meta_value = maybe_serialize($meta_value); 2351 2352 if (empty($meta_value)) { 2353 return delete_usermeta($user_id, $meta_key); 2354 } 2355 2356 $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); 2357 2358 if ( $cur ) 2359 do_action( 'update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); 2360 2361 if ( !$cur ) 2362 $wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') ); 2363 elseif ( $cur->meta_value != $meta_value ) 2364 $wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') ); 2365 else 2366 return false; 2367 2368 clean_user_cache( $user_id ); 2369 wp_cache_delete( $user_id, 'user_meta' ); 2370 2371 if ( !$cur ) 2372 do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value ); 2373 else 2374 do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value ); 2375 2376 return true; 2377} 2378 2379/** 2380 * Get users for the site. 2381 * 2382 * For setups that use the multisite feature. Can be used outside of the 2383 * multisite feature. 2384 * 2385 * @since 2.2.0 2386 * @deprecated 3.1.0 Use get_users() 2387 * @see get_users() 2388 * 2389 * @global wpdb $wpdb WordPress database abstraction object. 2390 * 2391 * @param int $id Site ID. 2392 * @return array List of users that are part of that site ID 2393 */ 2394function get_users_of_blog( $id = '' ) { 2395 _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' ); 2396 2397 global $wpdb; 2398 if ( empty( $id ) ) { 2399 $id = get_current_blog_id(); 2400 } 2401 $blog_prefix = $wpdb->get_blog_prefix($id); 2402 $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" ); 2403 return $users; 2404} 2405 2406/** 2407 * Enable/disable automatic general feed link outputting. 2408 * 2409 * @since 2.8.0 2410 * @deprecated 3.0.0 Use add_theme_support() 2411 * @see add_theme_support() 2412 * 2413 * @param bool $add Optional. Add or remove links. Default true. 2414 */ 2415function automatic_feed_links( $add = true ) { 2416 _deprecated_function( __FUNCTION__, '3.0.0', "add_theme_support( 'automatic-feed-links' )" ); 2417 2418 if ( $add ) 2419 add_theme_support( 'automatic-feed-links' ); 2420 else 2421 remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+. 2422} 2423 2424/** 2425 * Retrieve user data based on field. 2426 * 2427 * @since 1.5.0 2428 * @deprecated 3.0.0 Use get_the_author_meta() 2429 * @see get_the_author_meta() 2430 * 2431 * @param string $field User meta field. 2432 * @param false|int $user Optional. User ID to retrieve the field for. Default false (current user). 2433 * @return string The author's field from the current author's DB object. 2434 */ 2435function get_profile( $field, $user = false ) { 2436 _deprecated_function( __FUNCTION__, '3.0.0', 'get_the_author_meta()' ); 2437 if ( $user ) { 2438 $user = get_user_by( 'login', $user ); 2439 $user = $user->ID; 2440 } 2441 return get_the_author_meta( $field, $user ); 2442} 2443 2444/** 2445 * Retrieves the number of posts a user has written. 2446 * 2447 * @since 0.71 2448 * @deprecated 3.0.0 Use count_user_posts() 2449 * @see count_user_posts() 2450 * 2451 * @param int $userid User to count posts for. 2452 * @return int Number of posts the given user has written. 2453 */ 2454function get_usernumposts( $userid ) { 2455 _deprecated_function( __FUNCTION__, '3.0.0', 'count_user_posts()' ); 2456 return count_user_posts( $userid ); 2457} 2458 2459/** 2460 * Callback used to change %uXXXX to &#YYY; syntax 2461 * 2462 * @since 2.8.0 2463 * @access private 2464 * @deprecated 3.0.0 2465 * 2466 * @param array $matches Single Match 2467 * @return string An HTML entity 2468 */ 2469function funky_javascript_callback($matches) { 2470 return "&#".base_convert($matches[1],16,10).";"; 2471} 2472 2473/** 2474 * Fixes JavaScript bugs in browsers. 2475 * 2476 * Converts unicode characters to HTML numbered entities. 2477 * 2478 * @since 1.5.0 2479 * @deprecated 3.0.0 2480 * 2481 * @global $is_macIE 2482 * @global $is_winIE 2483 * 2484 * @param string $text Text to be made safe. 2485 * @return string Fixed text. 2486 */ 2487function funky_javascript_fix($text) { 2488 _deprecated_function( __FUNCTION__, '3.0.0' ); 2489 // Fixes for browsers' JavaScript bugs. 2490 global $is_macIE, $is_winIE; 2491 2492 if ( $is_winIE || $is_macIE ) 2493 $text = preg_replace_callback("/\%u([0-9A-F]{4,4})/", 2494 "funky_javascript_callback", 2495 $text); 2496 2497 return $text; 2498} 2499 2500/** 2501 * Checks that the taxonomy name exists. 2502 * 2503 * @since 2.3.0 2504 * @deprecated 3.0.0 Use taxonomy_exists() 2505 * @see taxonomy_exists() 2506 * 2507 * @param string $taxonomy Name of taxonomy object 2508 * @return bool Whether the taxonomy exists. 2509 */ 2510function is_taxonomy( $taxonomy ) { 2511 _deprecated_function( __FUNCTION__, '3.0.0', 'taxonomy_exists()' ); 2512 return taxonomy_exists( $taxonomy ); 2513} 2514 2515/** 2516 * Check if Term exists. 2517 * 2518 * @since 2.3.0 2519 * @deprecated 3.0.0 Use term_exists() 2520 * @see term_exists() 2521 * 2522 * @param int|string $term The term to check 2523 * @param string $taxonomy The taxonomy name to use 2524 * @param int $parent ID of parent term under which to confine the exists search. 2525 * @return mixed Get the term ID or term object, if exists. 2526 */ 2527function is_term( $term, $taxonomy = '', $parent = 0 ) { 2528 _deprecated_function( __FUNCTION__, '3.0.0', 'term_exists()' ); 2529 return term_exists( $term, $taxonomy, $parent ); 2530} 2531 2532/** 2533 * Determines whether the current admin page is generated by a plugin. 2534 * 2535 * Use global $plugin_page and/or get_plugin_page_hookname() hooks. 2536 * 2537 * For more information on this and similar theme functions, check out 2538 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ 2539 * Conditional Tags} article in the Theme Developer Handbook. 2540 * 2541 * @since 1.5.0 2542 * @deprecated 3.1.0 2543 * 2544 * @global $plugin_page 2545 * 2546 * @return bool 2547 */ 2548function is_plugin_page() { 2549 _deprecated_function( __FUNCTION__, '3.1.0' ); 2550 2551 global $plugin_page; 2552 2553 if ( isset($plugin_page) ) 2554 return true; 2555 2556 return false; 2557} 2558 2559/** 2560 * Update the categories cache. 2561 * 2562 * This function does not appear to be used anymore or does not appear to be 2563 * needed. It might be a legacy function left over from when there was a need 2564 * for updating the category cache. 2565 * 2566 * @since 1.5.0 2567 * @deprecated 3.1.0 2568 * 2569 * @return bool Always return True 2570 */ 2571function update_category_cache() { 2572 _deprecated_function( __FUNCTION__, '3.1.0' ); 2573 2574 return true; 2575} 2576 2577/** 2578 * Check for PHP timezone support 2579 * 2580 * @since 2.9.0 2581 * @deprecated 3.2.0 2582 * 2583 * @return bool 2584 */ 2585function wp_timezone_supported() { 2586 _deprecated_function( __FUNCTION__, '3.2.0' ); 2587 2588 return true; 2589} 2590 2591/** 2592 * Displays an editor: TinyMCE, HTML, or both. 2593 * 2594 * @since 2.1.0 2595 * @deprecated 3.3.0 Use wp_editor() 2596 * @see wp_editor() 2597 * 2598 * @param string $content Textarea content. 2599 * @param string $id Optional. HTML ID attribute value. Default 'content'. 2600 * @param string $prev_id Optional. Unused. 2601 * @param bool $media_buttons Optional. Whether to display media buttons. Default true. 2602 * @param int $tab_index Optional. Unused. 2603 * @param bool $extended Optional. Unused. 2604 */ 2605function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2, $extended = true) { 2606 _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' ); 2607 2608 wp_editor( $content, $id, array( 'media_buttons' => $media_buttons ) ); 2609} 2610 2611/** 2612 * Perform the query to get the $metavalues array(s) needed by _fill_user and _fill_many_users 2613 * 2614 * @since 3.0.0 2615 * @deprecated 3.3.0 2616 * 2617 * @param array $ids User ID numbers list. 2618 * @return array of arrays. The array is indexed by user_id, containing $metavalues object arrays. 2619 */ 2620function get_user_metavalues($ids) { 2621 _deprecated_function( __FUNCTION__, '3.3.0' ); 2622 2623 $objects = array(); 2624 2625 $ids = array_map('intval', $ids); 2626 foreach ( $ids as $id ) 2627 $objects[$id] = array(); 2628 2629 $metas = update_meta_cache('user', $ids); 2630 2631 foreach ( $metas as $id => $meta ) { 2632 foreach ( $meta as $key => $metavalues ) { 2633 foreach ( $metavalues as $value ) { 2634 $objects[$id][] = (object)array( 'user_id' => $id, 'meta_key' => $key, 'meta_value' => $value); 2635 } 2636 } 2637 } 2638 2639 return $objects; 2640} 2641 2642/** 2643 * Sanitize every user field. 2644 * 2645 * If the context is 'raw', then the user object or array will get minimal santization of the int fields. 2646 * 2647 * @since 2.3.0 2648 * @deprecated 3.3.0 2649 * 2650 * @param object|array $user The user object or array. 2651 * @param string $context Optional. How to sanitize user fields. Default 'display'. 2652 * @return object|array The now sanitized user object or array (will be the same type as $user). 2653 */ 2654function sanitize_user_object($user, $context = 'display') { 2655 _deprecated_function( __FUNCTION__, '3.3.0' ); 2656 2657 if ( is_object($user) ) { 2658 if ( !isset($user->ID) ) 2659 $user->ID = 0; 2660 if ( ! ( $user instanceof WP_User ) ) { 2661 $vars = get_object_vars($user); 2662 foreach ( array_keys($vars) as $field ) { 2663 if ( is_string($user->$field) || is_numeric($user->$field) ) 2664 $user->$field = sanitize_user_field($field, $user->$field, $user->ID, $context); 2665 } 2666 } 2667 $user->filter = $context; 2668 } else { 2669 if ( !isset($user['ID']) ) 2670 $user['ID'] = 0; 2671 foreach ( array_keys($user) as $field ) 2672 $user[$field] = sanitize_user_field($field, $user[$field], $user['ID'], $context); 2673 $user['filter'] = $context; 2674 } 2675 2676 return $user; 2677} 2678 2679/** 2680 * Get boundary post relational link. 2681 * 2682 * Can either be start or end post relational link. 2683 * 2684 * @since 2.8.0 2685 * @deprecated 3.3.0 2686 * 2687 * @param string $title Optional. Link title format. Default '%title'. 2688 * @param bool $in_same_cat Optional. Whether link should be in a same category. 2689 * Default false. 2690 * @param string $excluded_categories Optional. Excluded categories IDs. Default empty. 2691 * @param bool $start Optional. Whether to display link to first or last post. 2692 * Default true. 2693 * @return string 2694 */ 2695function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) { 2696 _deprecated_function( __FUNCTION__, '3.3.0' ); 2697 2698 $posts = get_boundary_post($in_same_cat, $excluded_categories, $start); 2699 // If there is no post, stop. 2700 if ( empty($posts) ) 2701 return; 2702 2703 // Even though we limited get_posts() to return only 1 item it still returns an array of objects. 2704 $post = $posts[0]; 2705 2706 if ( empty($post->post_title) ) 2707 $post->post_title = $start ? __('First Post') : __('Last Post'); 2708 2709 $date = mysql2date(get_option('date_format'), $post->post_date); 2710 2711 $title = str_replace('%title', $post->post_title, $title); 2712 $title = str_replace('%date', $date, $title); 2713 $title = apply_filters('the_title', $title, $post->ID); 2714 2715 $link = $start ? "<link rel='start' title='" : "<link rel='end' title='"; 2716 $link .= esc_attr($title); 2717 $link .= "' href='" . get_permalink($post) . "' />\n"; 2718 2719 $boundary = $start ? 'start' : 'end'; 2720 return apply_filters( "{$boundary}_post_rel_link", $link ); 2721} 2722 2723/** 2724 * Display relational link for the first post. 2725 * 2726 * @since 2.8.0 2727 * @deprecated 3.3.0 2728 * 2729 * @param string $title Optional. Link title format. 2730 * @param bool $in_same_cat Optional. Whether link should be in a same category. 2731 * @param string $excluded_categories Optional. Excluded categories IDs. 2732 */ 2733function start_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') { 2734 _deprecated_function( __FUNCTION__, '3.3.0' ); 2735 2736 echo get_boundary_post_rel_link($title, $in_same_cat, $excluded_categories, true); 2737} 2738 2739/** 2740 * Get site index relational link. 2741 * 2742 * @since 2.8.0 2743 * @deprecated 3.3.0 2744 * 2745 * @return string 2746 */ 2747function get_index_rel_link() { 2748 _deprecated_function( __FUNCTION__, '3.3.0' ); 2749 2750 $link = "<link rel='index' title='" . esc_attr( get_bloginfo( 'name', 'display' ) ) . "' href='" . esc_url( user_trailingslashit( get_bloginfo( 'url', 'display' ) ) ) . "' />\n"; 2751 return apply_filters( "index_rel_link", $link ); 2752} 2753 2754/** 2755 * Display relational link for the site index. 2756 * 2757 * @since 2.8.0 2758 * @deprecated 3.3.0 2759 */ 2760function index_rel_link() { 2761 _deprecated_function( __FUNCTION__, '3.3.0' ); 2762 2763 echo get_index_rel_link(); 2764} 2765 2766/** 2767 * Get parent post relational link. 2768 * 2769 * @since 2.8.0 2770 * @deprecated 3.3.0 2771 * 2772 * @param string $title Optional. Link title format. Default '%title'. 2773 * @return string 2774 */ 2775function get_parent_post_rel_link( $title = '%title' ) { 2776 _deprecated_function( __FUNCTION__, '3.3.0' ); 2777 2778 if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) ) 2779 $post = get_post($GLOBALS['post']->post_parent); 2780 2781 if ( empty($post) ) 2782 return; 2783 2784 $date = mysql2date(get_option('date_format'), $post->post_date); 2785 2786 $title = str_replace('%title', $post->post_title, $title); 2787 $title = str_replace('%date', $date, $title); 2788 $title = apply_filters('the_title', $title, $post->ID); 2789 2790 $link = "<link rel='up' title='"; 2791 $link .= esc_attr( $title ); 2792 $link .= "' href='" . get_permalink($post) . "' />\n"; 2793 2794 return apply_filters( "parent_post_rel_link", $link ); 2795} 2796 2797/** 2798 * Display relational link for parent item 2799 * 2800 * @since 2.8.0 2801 * @deprecated 3.3.0 2802 * 2803 * @param string $title Optional. Link title format. Default '%title'. 2804 */ 2805function parent_post_rel_link( $title = '%title' ) { 2806 _deprecated_function( __FUNCTION__, '3.3.0' ); 2807 2808 echo get_parent_post_rel_link($title); 2809} 2810 2811/** 2812 * Add the "Dashboard"/"Visit Site" menu. 2813 * 2814 * @since 3.2.0 2815 * @deprecated 3.3.0 2816 * 2817 * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance. 2818 */ 2819function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) { 2820 _deprecated_function( __FUNCTION__, '3.3.0' ); 2821 2822 $user_id = get_current_user_id(); 2823 2824 if ( 0 != $user_id ) { 2825 if ( is_admin() ) 2826 $wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) ); 2827 elseif ( is_multisite() ) 2828 $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) ); 2829 else 2830 $wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) ); 2831 } 2832} 2833 2834/** 2835 * Checks if the current user belong to a given site. 2836 * 2837 * @since MU (3.0.0) 2838 * @deprecated 3.3.0 Use is_user_member_of_blog() 2839 * @see is_user_member_of_blog() 2840 * 2841 * @param int $blog_id Site ID 2842 * @return bool True if the current users belong to $blog_id, false if not. 2843 */ 2844function is_blog_user( $blog_id = 0 ) { 2845 _deprecated_function( __FUNCTION__, '3.3.0', 'is_user_member_of_blog()' ); 2846 2847 return is_user_member_of_blog( get_current_user_id(), $blog_id ); 2848} 2849 2850/** 2851 * Open the file handle for debugging. 2852 * 2853 * @since 0.71 2854 * @deprecated 3.4.0 Use error_log() 2855 * @see error_log() 2856 * 2857 * @link https://www.php.net/manual/en/function.error-log.php 2858 * 2859 * @param string $filename File name. 2860 * @param string $mode Type of access you required to the stream. 2861 * @return false Always false. 2862 */ 2863function debug_fopen( $filename, $mode ) { 2864 _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' ); 2865 return false; 2866} 2867 2868/** 2869 * Write contents to the file used for debugging. 2870 * 2871 * @since 0.71 2872 * @deprecated 3.4.0 Use error_log() 2873 * @see error_log() 2874 * 2875 * @link https://www.php.net/manual/en/function.error-log.php 2876 * 2877 * @param mixed $fp Unused. 2878 * @param string $string Message to log. 2879 */ 2880function debug_fwrite( $fp, $string ) { 2881 _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' ); 2882 if ( ! empty( $GLOBALS['debug'] ) ) 2883 error_log( $string ); 2884} 2885 2886/** 2887 * Close the debugging file handle. 2888 * 2889 * @since 0.71 2890 * @deprecated 3.4.0 Use error_log() 2891 * @see error_log() 2892 * 2893 * @link https://www.php.net/manual/en/function.error-log.php 2894 * 2895 * @param mixed $fp Unused. 2896 */ 2897function debug_fclose( $fp ) { 2898 _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' ); 2899} 2900 2901/** 2902 * Retrieve list of themes with theme data in theme directory. 2903 * 2904 * The theme is broken, if it doesn't have a parent theme and is missing either 2905 * style.css and, or index.php. If the theme has a parent theme then it is 2906 * broken, if it is missing style.css; index.php is optional. 2907 * 2908 * @since 1.5.0 2909 * @deprecated 3.4.0 Use wp_get_themes() 2910 * @see wp_get_themes() 2911 * 2912 * @return array Theme list with theme data. 2913 */ 2914function get_themes() { 2915 _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_themes()' ); 2916 2917 global $wp_themes; 2918 if ( isset( $wp_themes ) ) 2919 return $wp_themes; 2920 2921 $themes = wp_get_themes(); 2922 $wp_themes = array(); 2923 2924 foreach ( $themes as $theme ) { 2925 $name = $theme->get('Name'); 2926 if ( isset( $wp_themes[ $name ] ) ) 2927 $wp_themes[ $name . '/' . $theme->get_stylesheet() ] = $theme; 2928 else 2929 $wp_themes[ $name ] = $theme; 2930 } 2931 2932 return $wp_themes; 2933} 2934 2935/** 2936 * Retrieve theme data. 2937 * 2938 * @since 1.5.0 2939 * @deprecated 3.4.0 Use wp_get_theme() 2940 * @see wp_get_theme() 2941 * 2942 * @param string $theme Theme name. 2943 * @return array|null Null, if theme name does not exist. Theme data, if exists. 2944 */ 2945function get_theme( $theme ) { 2946 _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme( $stylesheet )' ); 2947 2948 $themes = get_themes(); 2949 if ( is_array( $themes ) && array_key_exists( $theme, $themes ) ) 2950 return $themes[ $theme ]; 2951 return null; 2952} 2953 2954/** 2955 * Retrieve current theme name. 2956 * 2957 * @since 1.5.0 2958 * @deprecated 3.4.0 Use wp_get_theme() 2959 * @see wp_get_theme() 2960 * 2961 * @return string 2962 */ 2963function get_current_theme() { 2964 _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' ); 2965 2966 if ( $theme = get_option( 'current_theme' ) ) 2967 return $theme; 2968 2969 return wp_get_theme()->get('Name'); 2970} 2971 2972/** 2973 * Accepts matches array from preg_replace_callback in wpautop() or a string. 2974 * 2975 * Ensures that the contents of a `<pre>...</pre>` HTML block are not 2976 * converted into paragraphs or line breaks. 2977 * 2978 * @since 1.2.0 2979 * @deprecated 3.4.0 2980 * 2981 * @param array|string $matches The array or string 2982 * @return string The pre block without paragraph/line break conversion. 2983 */ 2984function clean_pre($matches) { 2985 _deprecated_function( __FUNCTION__, '3.4.0' ); 2986 2987 if ( is_array($matches) ) 2988 $text = $matches[1] . $matches[2] . "</pre>"; 2989 else 2990 $text = $matches; 2991 2992 $text = str_replace(array('<br />', '<br/>', '<br>'), array('', '', ''), $text); 2993 $text = str_replace('<p>', "\n", $text); 2994 $text = str_replace('</p>', '', $text); 2995 2996 return $text; 2997} 2998 2999 3000/** 3001 * Add callbacks for image header display. 3002 * 3003 * @since 2.1.0 3004 * @deprecated 3.4.0 Use add_theme_support() 3005 * @see add_theme_support() 3006 * 3007 * @param callable $wp_head_callback Call on the {@see 'wp_head'} action. 3008 * @param callable $admin_head_callback Call on custom header administration screen. 3009 * @param callable $admin_preview_callback Output a custom header image div on the custom header administration screen. Optional. 3010 */ 3011function add_custom_image_header( $wp_head_callback, $admin_head_callback, $admin_preview_callback = '' ) { 3012 _deprecated_function( __FUNCTION__, '3.4.0', 'add_theme_support( \'custom-header\', $args )' ); 3013 $args = array( 3014 'wp-head-callback' => $wp_head_callback, 3015 'admin-head-callback' => $admin_head_callback, 3016 ); 3017 if ( $admin_preview_callback ) 3018 $args['admin-preview-callback'] = $admin_preview_callback; 3019 return add_theme_support( 'custom-header', $args ); 3020} 3021 3022/** 3023 * Remove image header support. 3024 * 3025 * @since 3.1.0 3026 * @deprecated 3.4.0 Use remove_theme_support() 3027 * @see remove_theme_support() 3028 * 3029 * @return null|bool Whether support was removed. 3030 */ 3031function remove_custom_image_header() { 3032 _deprecated_function( __FUNCTION__, '3.4.0', 'remove_theme_support( \'custom-header\' )' ); 3033 return remove_theme_support( 'custom-header' ); 3034} 3035 3036/** 3037 * Add callbacks for background image display. 3038 * 3039 * @since 3.0.0 3040 * @deprecated 3.4.0 Use add_theme_support() 3041 * @see add_theme_support() 3042 * 3043 * @param callable $wp_head_callback Call on the {@see 'wp_head'} action. 3044 * @param callable $admin_head_callback Call on custom background administration screen. 3045 * @param callable $admin_preview_callback Output a custom background image div on the custom background administration screen. Optional. 3046 */ 3047function add_custom_background( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' ) { 3048 _deprecated_function( __FUNCTION__, '3.4.0', 'add_theme_support( \'custom-background\', $args )' ); 3049 $args = array(); 3050 if ( $wp_head_callback ) 3051 $args['wp-head-callback'] = $wp_head_callback; 3052 if ( $admin_head_callback ) 3053 $args['admin-head-callback'] = $admin_head_callback; 3054 if ( $admin_preview_callback ) 3055 $args['admin-preview-callback'] = $admin_preview_callback; 3056 return add_theme_support( 'custom-background', $args ); 3057} 3058 3059/** 3060 * Remove custom background support. 3061 * 3062 * @since 3.1.0 3063 * @deprecated 3.4.0 Use add_custom_background() 3064 * @see add_custom_background() 3065 * 3066 * @return null|bool Whether support was removed. 3067 */ 3068function remove_custom_background() { 3069 _deprecated_function( __FUNCTION__, '3.4.0', 'remove_theme_support( \'custom-background\' )' ); 3070 return remove_theme_support( 'custom-background' ); 3071} 3072 3073/** 3074 * Retrieve theme data from parsed theme file. 3075 * 3076 * @since 1.5.0 3077 * @deprecated 3.4.0 Use wp_get_theme() 3078 * @see wp_get_theme() 3079 * 3080 * @param string $theme_file Theme file path. 3081 * @return array Theme data. 3082 */ 3083function get_theme_data( $theme_file ) { 3084 _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' ); 3085 $theme = new WP_Theme( wp_basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) ); 3086 3087 $theme_data = array( 3088 'Name' => $theme->get('Name'), 3089 'URI' => $theme->display('ThemeURI', true, false), 3090 'Description' => $theme->display('Description', true, false), 3091 'Author' => $theme->display('Author', true, false), 3092 'AuthorURI' => $theme->display('AuthorURI', true, false), 3093 'Version' => $theme->get('Version'), 3094 'Template' => $theme->get('Template'), 3095 'Status' => $theme->get('Status'), 3096 'Tags' => $theme->get('Tags'), 3097 'Title' => $theme->get('Name'), 3098 'AuthorName' => $theme->get('Author'), 3099 ); 3100 3101 foreach ( apply_filters( 'extra_theme_headers', array() ) as $extra_header ) { 3102 if ( ! isset( $theme_data[ $extra_header ] ) ) 3103 $theme_data[ $extra_header ] = $theme->get( $extra_header ); 3104 } 3105 3106 return $theme_data; 3107} 3108 3109/** 3110 * Alias of update_post_cache(). 3111 * 3112 * @see update_post_cache() Posts and pages are the same, alias is intentional 3113 * 3114 * @since 1.5.1 3115 * @deprecated 3.4.0 Use update_post_cache() 3116 * @see update_post_cache() 3117 * 3118 * @param array $pages list of page objects 3119 */ 3120function update_page_cache( &$pages ) { 3121 _deprecated_function( __FUNCTION__, '3.4.0', 'update_post_cache()' ); 3122 3123 update_post_cache( $pages ); 3124} 3125 3126/** 3127 * Will clean the page in the cache. 3128 * 3129 * Clean (read: delete) page from cache that matches $id. Will also clean cache 3130 * associated with 'all_page_ids' and 'get_pages'. 3131 * 3132 * @since 2.0.0 3133 * @deprecated 3.4.0 Use clean_post_cache 3134 * @see clean_post_cache() 3135 * 3136 * @param int $id Page ID to clean 3137 */ 3138function clean_page_cache( $id ) { 3139 _deprecated_function( __FUNCTION__, '3.4.0', 'clean_post_cache()' ); 3140 3141 clean_post_cache( $id ); 3142} 3143 3144/** 3145 * Retrieve nonce action "Are you sure" message. 3146 * 3147 * Deprecated in 3.4.1 and 3.5.0. Backported to 3.3.3. 3148 * 3149 * @since 2.0.4 3150 * @deprecated 3.4.1 Use wp_nonce_ays() 3151 * @see wp_nonce_ays() 3152 * 3153 * @param string $action Nonce action. 3154 * @return string Are you sure message. 3155 */ 3156function wp_explain_nonce( $action ) { 3157 _deprecated_function( __FUNCTION__, '3.4.1', 'wp_nonce_ays()' ); 3158 return __( 'Are you sure you want to do this?' ); 3159} 3160 3161/** 3162 * Display "sticky" CSS class, if a post is sticky. 3163 * 3164 * @since 2.7.0 3165 * @deprecated 3.5.0 Use post_class() 3166 * @see post_class() 3167 * 3168 * @param int $post_id An optional post ID. 3169 */ 3170function sticky_class( $post_id = null ) { 3171 _deprecated_function( __FUNCTION__, '3.5.0', 'post_class()' ); 3172 if ( is_sticky( $post_id ) ) 3173 echo ' sticky'; 3174} 3175 3176/** 3177 * Retrieve post ancestors. 3178 * 3179 * This is no longer needed as WP_Post lazy-loads the ancestors 3180 * property with get_post_ancestors(). 3181 * 3182 * @since 2.3.4 3183 * @deprecated 3.5.0 Use get_post_ancestors() 3184 * @see get_post_ancestors() 3185 * 3186 * @param WP_Post $post Post object, passed by reference (unused). 3187 */ 3188function _get_post_ancestors( &$post ) { 3189 _deprecated_function( __FUNCTION__, '3.5.0' ); 3190} 3191 3192/** 3193 * Load an image from a string, if PHP supports it. 3194 * 3195 * @since 2.1.0 3196 * @deprecated 3.5.0 Use wp_get_image_editor() 3197 * @see wp_get_image_editor() 3198 * 3199 * @param string $file Filename of the image to load. 3200 * @return resource|GdImage|string The resulting image resource or GdImage instance on success, 3201 * error string on failure. 3202 */ 3203function wp_load_image( $file ) { 3204 _deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' ); 3205 3206 if ( is_numeric( $file ) ) 3207 $file = get_attached_file( $file ); 3208 3209 if ( ! is_file( $file ) ) { 3210 /* translators: %s: File name. */ 3211 return sprintf( __( 'File “%s” doesn’t exist?' ), $file ); 3212 } 3213 3214 if ( ! function_exists('imagecreatefromstring') ) 3215 return __('The GD image library is not installed.'); 3216 3217 // Set artificially high because GD uses uncompressed images in memory. 3218 wp_raise_memory_limit( 'image' ); 3219 3220 $image = imagecreatefromstring( file_get_contents( $file ) ); 3221 3222 if ( ! is_gd_image( $image ) ) { 3223 /* translators: %s: File name. */ 3224 return sprintf( __( 'File “%s” is not an image.' ), $file ); 3225 } 3226 3227 return $image; 3228} 3229 3230/** 3231 * Scale down an image to fit a particular size and save a new copy of the image. 3232 * 3233 * The PNG transparency will be preserved using the function, as well as the 3234 * image type. If the file going in is PNG, then the resized image is going to 3235 * be PNG. The only supported image types are PNG, GIF, and JPEG. 3236 * 3237 * Some functionality requires API to exist, so some PHP version may lose out 3238 * support. This is not the fault of WordPress (where functionality is 3239 * downgraded, not actual defects), but of your PHP version. 3240 * 3241 * @since 2.5.0 3242 * @deprecated 3.5.0 Use wp_get_image_editor() 3243 * @see wp_get_image_editor() 3244 * 3245 * @param string $file Image file path. 3246 * @param int $max_w Maximum width to resize to. 3247 * @param int $max_h Maximum height to resize to. 3248 * @param bool $crop Optional. Whether to crop image or resize. Default false. 3249 * @param string $suffix Optional. File suffix. Default null. 3250 * @param string $dest_path Optional. New image file path. Default null. 3251 * @param int $jpeg_quality Optional. Image quality percentage. Default 90. 3252 * @return mixed WP_Error on failure. String with new destination path. 3253 */ 3254function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) { 3255 _deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' ); 3256 3257 $editor = wp_get_image_editor( $file ); 3258 if ( is_wp_error( $editor ) ) 3259 return $editor; 3260 $editor->set_quality( $jpeg_quality ); 3261 3262 $resized = $editor->resize( $max_w, $max_h, $crop ); 3263 if ( is_wp_error( $resized ) ) 3264 return $resized; 3265 3266 $dest_file = $editor->generate_filename( $suffix, $dest_path ); 3267 $saved = $editor->save( $dest_file ); 3268 3269 if ( is_wp_error( $saved ) ) 3270 return $saved; 3271 3272 return $dest_file; 3273} 3274 3275/** 3276 * Retrieve a single post, based on post ID. 3277 * 3278 * Has categories in 'post_category' property or key. Has tags in 'tags_input' 3279 * property or key. 3280 * 3281 * @since 1.0.0 3282 * @deprecated 3.5.0 Use get_post() 3283 * @see get_post() 3284 * 3285 * @param int $postid Post ID. 3286 * @param string $mode How to return result, either OBJECT, ARRAY_N, or ARRAY_A. 3287 * @return WP_Post|null Post object or array holding post contents and information 3288 */ 3289function wp_get_single_post( $postid = 0, $mode = OBJECT ) { 3290 _deprecated_function( __FUNCTION__, '3.5.0', 'get_post()' ); 3291 return get_post( $postid, $mode ); 3292} 3293 3294/** 3295 * Check that the user login name and password is correct. 3296 * 3297 * @since 0.71 3298 * @deprecated 3.5.0 Use wp_authenticate() 3299 * @see wp_authenticate() 3300 * 3301 * @param string $user_login User name. 3302 * @param string $user_pass User password. 3303 * @return bool False if does not authenticate, true if username and password authenticates. 3304 */ 3305function user_pass_ok($user_login, $user_pass) { 3306 _deprecated_function( __FUNCTION__, '3.5.0', 'wp_authenticate()' ); 3307 $user = wp_authenticate( $user_login, $user_pass ); 3308 if ( is_wp_error( $user ) ) 3309 return false; 3310 3311 return true; 3312} 3313 3314/** 3315 * Callback formerly fired on the save_post hook. No longer needed. 3316 * 3317 * @since 2.3.0 3318 * @deprecated 3.5.0 3319 */ 3320function _save_post_hook() {} 3321 3322/** 3323 * Check if the installed version of GD supports particular image type 3324 * 3325 * @since 2.9.0 3326 * @deprecated 3.5.0 Use wp_image_editor_supports() 3327 * @see wp_image_editor_supports() 3328 * 3329 * @param string $mime_type 3330 * @return bool 3331 */ 3332function gd_edit_image_support($mime_type) { 3333 _deprecated_function( __FUNCTION__, '3.5.0', 'wp_image_editor_supports()' ); 3334 3335 if ( function_exists('imagetypes') ) { 3336 switch( $mime_type ) { 3337 case 'image/jpeg': 3338 return (imagetypes() & IMG_JPG) != 0; 3339 case 'image/png': 3340 return (imagetypes() & IMG_PNG) != 0; 3341 case 'image/gif': 3342 return (imagetypes() & IMG_GIF) != 0; 3343 case 'image/webp': 3344 return (imagetypes() & IMG_WEBP) != 0; // phpcs:ignore PHPCompatibility.Constants.NewConstants.img_webpFound 3345 } 3346 } else { 3347 switch( $mime_type ) { 3348 case 'image/jpeg': 3349 return function_exists('imagecreatefromjpeg'); 3350 case 'image/png': 3351 return function_exists('imagecreatefrompng'); 3352 case 'image/gif': 3353 return function_exists('imagecreatefromgif'); 3354 case 'image/webp': 3355 return function_exists('imagecreatefromwebp'); 3356 } 3357 } 3358 return false; 3359} 3360 3361/** 3362 * Converts an integer byte value to a shorthand byte value. 3363 * 3364 * @since 2.3.0 3365 * @deprecated 3.6.0 Use size_format() 3366 * @see size_format() 3367 * 3368 * @param int $bytes An integer byte value. 3369 * @return string A shorthand byte value. 3370 */ 3371function wp_convert_bytes_to_hr( $bytes ) { 3372 _deprecated_function( __FUNCTION__, '3.6.0', 'size_format()' ); 3373 3374 $units = array( 0 => 'B', 1 => 'KB', 2 => 'MB', 3 => 'GB', 4 => 'TB' ); 3375 $log = log( $bytes, KB_IN_BYTES ); 3376 $power = (int) $log; 3377 $size = KB_IN_BYTES ** ( $log - $power ); 3378 3379 if ( ! is_nan( $size ) && array_key_exists( $power, $units ) ) { 3380 $unit = $units[ $power ]; 3381 } else { 3382 $size = $bytes; 3383 $unit = $units[0]; 3384 } 3385 3386 return $size . $unit; 3387} 3388 3389/** 3390 * Formerly used internally to tidy up the search terms. 3391 * 3392 * @since 2.9.0 3393 * @access private 3394 * @deprecated 3.7.0 3395 * 3396 * @param string $t Search terms to "tidy", e.g. trim. 3397 * @return string Trimmed search terms. 3398 */ 3399function _search_terms_tidy( $t ) { 3400 _deprecated_function( __FUNCTION__, '3.7.0' ); 3401 return trim( $t, "\"'\n\r " ); 3402} 3403 3404/** 3405 * Determine if TinyMCE is available. 3406 * 3407 * Checks to see if the user has deleted the tinymce files to slim down 3408 * their WordPress installation. 3409 * 3410 * @since 2.1.0 3411 * @deprecated 3.9.0 3412 * 3413 * @return bool Whether TinyMCE exists. 3414 */ 3415function rich_edit_exists() { 3416 global $wp_rich_edit_exists; 3417 _deprecated_function( __FUNCTION__, '3.9.0' ); 3418 3419 if ( ! isset( $wp_rich_edit_exists ) ) 3420 $wp_rich_edit_exists = file_exists( ABSPATH . WPINC . '/js/tinymce/tinymce.js' ); 3421 3422 return $wp_rich_edit_exists; 3423} 3424 3425/** 3426 * Old callback for tag link tooltips. 3427 * 3428 * @since 2.7.0 3429 * @access private 3430 * @deprecated 3.9.0 3431 * 3432 * @param int $count Number of topics. 3433 * @return int Number of topics. 3434 */ 3435function default_topic_count_text( $count ) { 3436 return $count; 3437} 3438 3439/** 3440 * Formerly used to escape strings before inserting into the DB. 3441 * 3442 * Has not performed this function for many, many years. Use wpdb::prepare() instead. 3443 * 3444 * @since 0.71 3445 * @deprecated 3.9.0 3446 * 3447 * @param string $content The text to format. 3448 * @return string The very same text. 3449 */ 3450function format_to_post( $content ) { 3451 _deprecated_function( __FUNCTION__, '3.9.0' ); 3452 return $content; 3453} 3454 3455/** 3456 * Formerly used to escape strings before searching the DB. It was poorly documented and never worked as described. 3457 * 3458 * @since 2.5.0 3459 * @deprecated 4.0.0 Use wpdb::esc_like() 3460 * @see wpdb::esc_like() 3461 * 3462 * @param string $text The text to be escaped. 3463 * @return string text, safe for inclusion in LIKE query. 3464 */ 3465function like_escape($text) { 3466 _deprecated_function( __FUNCTION__, '4.0.0', 'wpdb::esc_like()' ); 3467 return str_replace( array( "%", "_" ), array( "\\%", "\\_" ), $text ); 3468} 3469 3470/** 3471 * Determines if the URL can be accessed over SSL. 3472 * 3473 * Determines if the URL can be accessed over SSL by using the WordPress HTTP API to access 3474 * the URL using https as the scheme. 3475 * 3476 * @since 2.5.0 3477 * @deprecated 4.0.0 3478 * 3479 * @param string $url The URL to test. 3480 * @return bool Whether SSL access is available. 3481 */ 3482function url_is_accessable_via_ssl( $url ) { 3483 _deprecated_function( __FUNCTION__, '4.0.0' ); 3484 3485 $response = wp_remote_get( set_url_scheme( $url, 'https' ) ); 3486 3487 if ( !is_wp_error( $response ) ) { 3488 $status = wp_remote_retrieve_response_code( $response ); 3489 if ( 200 == $status || 401 == $status ) { 3490 return true; 3491 } 3492 } 3493 3494 return false; 3495} 3496 3497/** 3498 * Start preview theme output buffer. 3499 * 3500 * Will only perform task if the user has permissions and template and preview 3501 * query variables exist. 3502 * 3503 * @since 2.6.0 3504 * @deprecated 4.3.0 3505 */ 3506function preview_theme() { 3507 _deprecated_function( __FUNCTION__, '4.3.0' ); 3508} 3509 3510/** 3511 * Private function to modify the current template when previewing a theme 3512 * 3513 * @since 2.9.0 3514 * @deprecated 4.3.0 3515 * @access private 3516 * 3517 * @return string 3518 */ 3519function _preview_theme_template_filter() { 3520 _deprecated_function( __FUNCTION__, '4.3.0' ); 3521 return ''; 3522} 3523 3524/** 3525 * Private function to modify the current stylesheet when previewing a theme 3526 * 3527 * @since 2.9.0 3528 * @deprecated 4.3.0 3529 * @access private 3530 * 3531 * @return string 3532 */ 3533function _preview_theme_stylesheet_filter() { 3534 _deprecated_function( __FUNCTION__, '4.3.0' ); 3535 return ''; 3536} 3537 3538/** 3539 * Callback function for ob_start() to capture all links in the theme. 3540 * 3541 * @since 2.6.0 3542 * @deprecated 4.3.0 3543 * @access private 3544 * 3545 * @param string $content 3546 * @return string 3547 */ 3548function preview_theme_ob_filter( $content ) { 3549 _deprecated_function( __FUNCTION__, '4.3.0' ); 3550 return $content; 3551} 3552 3553/** 3554 * Manipulates preview theme links in order to control and maintain location. 3555 * 3556 * Callback function for preg_replace_callback() to accept and filter matches. 3557 * 3558 * @since 2.6.0 3559 * @deprecated 4.3.0 3560 * @access private 3561 * 3562 * @param array $matches 3563 * @return string 3564 */ 3565function preview_theme_ob_filter_callback( $matches ) { 3566 _deprecated_function( __FUNCTION__, '4.3.0' ); 3567 return ''; 3568} 3569 3570/** 3571 * Formats text for the rich text editor. 3572 * 3573 * The {@see 'richedit_pre'} filter is applied here. If `$text` is empty the filter will 3574 * be applied to an empty string. 3575 * 3576 * @since 2.0.0 3577 * @deprecated 4.3.0 Use format_for_editor() 3578 * @see format_for_editor() 3579 * 3580 * @param string $text The text to be formatted. 3581 * @return string The formatted text after filter is applied. 3582 */ 3583function wp_richedit_pre($text) { 3584 _deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' ); 3585 3586 if ( empty( $text ) ) { 3587 /** 3588 * Filters text returned for the rich text editor. 3589 * 3590 * This filter is first evaluated, and the value returned, if an empty string 3591 * is passed to wp_richedit_pre(). If an empty string is passed, it results 3592 * in a break tag and line feed. 3593 * 3594 * If a non-empty string is passed, the filter is evaluated on the wp_richedit_pre() 3595 * return after being formatted. 3596 * 3597 * @since 2.0.0 3598 * @deprecated 4.3.0 3599 * 3600 * @param string $output Text for the rich text editor. 3601 */ 3602 return apply_filters( 'richedit_pre', '' ); 3603 } 3604 3605 $output = convert_chars($text); 3606 $output = wpautop($output); 3607 $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); 3608 3609 /** This filter is documented in wp-includes/deprecated.php */ 3610 return apply_filters( 'richedit_pre', $output ); 3611} 3612 3613/** 3614 * Formats text for the HTML editor. 3615 * 3616 * Unless $output is empty it will pass through htmlspecialchars before the 3617 * {@see 'htmledit_pre'} filter is applied. 3618 * 3619 * @since 2.5.0 3620 * @deprecated 4.3.0 Use format_for_editor() 3621 * @see format_for_editor() 3622 * 3623 * @param string $output The text to be formatted. 3624 * @return string Formatted text after filter applied. 3625 */ 3626function wp_htmledit_pre($output) { 3627 _deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' ); 3628 3629 if ( !empty($output) ) 3630 $output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); // Convert only '< > &'. 3631 3632 /** 3633 * Filters the text before it is formatted for the HTML editor. 3634 * 3635 * @since 2.5.0 3636 * @deprecated 4.3.0 3637 * 3638 * @param string $output The HTML-formatted text. 3639 */ 3640 return apply_filters( 'htmledit_pre', $output ); 3641} 3642 3643/** 3644 * Retrieve permalink from post ID. 3645 * 3646 * @since 1.0.0 3647 * @deprecated 4.4.0 Use get_permalink() 3648 * @see get_permalink() 3649 * 3650 * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post. 3651 * @return string|false 3652 */ 3653function post_permalink( $post_id = 0 ) { 3654 _deprecated_function( __FUNCTION__, '4.4.0', 'get_permalink()' ); 3655 3656 return get_permalink( $post_id ); 3657} 3658 3659/** 3660 * Perform a HTTP HEAD or GET request. 3661 * 3662 * If $file_path is a writable filename, this will do a GET request and write 3663 * the file to that path. 3664 * 3665 * @since 2.5.0 3666 * @deprecated 4.4.0 Use WP_Http 3667 * @see WP_Http 3668 * 3669 * @param string $url URL to fetch. 3670 * @param string|bool $file_path Optional. File path to write request to. Default false. 3671 * @param int $red Optional. The number of Redirects followed, Upon 5 being hit, 3672 * returns false. Default 1. 3673 * @return bool|string False on failure and string of headers if HEAD request. 3674 */ 3675function wp_get_http( $url, $file_path = false, $red = 1 ) { 3676 _deprecated_function( __FUNCTION__, '4.4.0', 'WP_Http' ); 3677 3678 @set_time_limit( 60 ); 3679 3680 if ( $red > 5 ) 3681 return false; 3682 3683 $options = array(); 3684 $options['redirection'] = 5; 3685 3686 if ( false == $file_path ) 3687 $options['method'] = 'HEAD'; 3688 else 3689 $options['method'] = 'GET'; 3690 3691 $response = wp_safe_remote_request( $url, $options ); 3692 3693 if ( is_wp_error( $response ) ) 3694 return false; 3695 3696 $headers = wp_remote_retrieve_headers( $response ); 3697 $headers['response'] = wp_remote_retrieve_response_code( $response ); 3698 3699 // WP_HTTP no longer follows redirects for HEAD requests. 3700 if ( 'HEAD' == $options['method'] && in_array($headers['response'], array(301, 302)) && isset( $headers['location'] ) ) { 3701 return wp_get_http( $headers['location'], $file_path, ++$red ); 3702 } 3703 3704 if ( false == $file_path ) 3705 return $headers; 3706 3707 // GET request - write it to the supplied filename. 3708 $out_fp = fopen($file_path, 'w'); 3709 if ( !$out_fp ) 3710 return $headers; 3711 3712 fwrite( $out_fp, wp_remote_retrieve_body( $response ) ); 3713 fclose($out_fp); 3714 clearstatcache(); 3715 3716 return $headers; 3717} 3718 3719/** 3720 * Whether SSL login should be forced. 3721 * 3722 * @since 2.6.0 3723 * @deprecated 4.4.0 Use force_ssl_admin() 3724 * @see force_ssl_admin() 3725 * 3726 * @param string|bool $force Optional Whether to force SSL login. Default null. 3727 * @return bool True if forced, false if not forced. 3728 */ 3729function force_ssl_login( $force = null ) { 3730 _deprecated_function( __FUNCTION__, '4.4.0', 'force_ssl_admin()' ); 3731 return force_ssl_admin( $force ); 3732} 3733 3734/** 3735 * Retrieve path of comment popup template in current or parent template. 3736 * 3737 * @since 1.5.0 3738 * @deprecated 4.5.0 3739 * 3740 * @return string Full path to comments popup template file. 3741 */ 3742function get_comments_popup_template() { 3743 _deprecated_function( __FUNCTION__, '4.5.0' ); 3744 3745 return ''; 3746} 3747 3748/** 3749 * Determines whether the current URL is within the comments popup window. 3750 * 3751 * For more information on this and similar theme functions, check out 3752 * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ 3753 * Conditional Tags} article in the Theme Developer Handbook. 3754 * 3755 * @since 1.5.0 3756 * @deprecated 4.5.0 3757 * 3758 * @return false Always returns false. 3759 */ 3760function is_comments_popup() { 3761 _deprecated_function( __FUNCTION__, '4.5.0' ); 3762 3763 return false; 3764} 3765 3766/** 3767 * Display the JS popup script to show a comment. 3768 * 3769 * @since 0.71 3770 * @deprecated 4.5.0 3771 */ 3772function comments_popup_script() { 3773 _deprecated_function( __FUNCTION__, '4.5.0' ); 3774} 3775 3776/** 3777 * Adds element attributes to open links in new tabs. 3778 * 3779 * @since 0.71 3780 * @deprecated 4.5.0 3781 * 3782 * @param string $text Content to replace links to open in a new tab. 3783 * @return string Content that has filtered links. 3784 */ 3785function popuplinks( $text ) { 3786 _deprecated_function( __FUNCTION__, '4.5.0' ); 3787 $text = preg_replace('/<a (.+?)>/i', "<a $1 target='_blank' rel='external'>", $text); 3788 return $text; 3789} 3790 3791/** 3792 * The Google Video embed handler callback. 3793 * 3794 * Deprecated function that previously assisted in turning Google Video URLs 3795 * into embeds but that service has since been shut down. 3796 * 3797 * @since 2.9.0 3798 * @deprecated 4.6.0 3799 * 3800 * @return string An empty string. 3801 */ 3802function wp_embed_handler_googlevideo( $matches, $attr, $url, $rawattr ) { 3803 _deprecated_function( __FUNCTION__, '4.6.0' ); 3804 3805 return ''; 3806} 3807 3808/** 3809 * Retrieve path of paged template in current or parent template. 3810 * 3811 * @since 1.5.0 3812 * @deprecated 4.7.0 The paged.php template is no longer part of the theme template hierarchy. 3813 * 3814 * @return string Full path to paged template file. 3815 */ 3816function get_paged_template() { 3817 _deprecated_function( __FUNCTION__, '4.7.0' ); 3818 3819 return get_query_template( 'paged' ); 3820} 3821 3822/** 3823 * Removes the HTML JavaScript entities found in early versions of Netscape 4. 3824 * 3825 * Previously, this function was pulled in from the original 3826 * import of kses and removed a specific vulnerability only 3827 * existent in early version of Netscape 4. However, this 3828 * vulnerability never affected any other browsers and can 3829 * be considered safe for the modern web. 3830 * 3831 * The regular expression which sanitized this vulnerability 3832 * has been removed in consideration of the performance and 3833 * energy demands it placed, now merely passing through its 3834 * input to the return. 3835 * 3836 * @since 1.0.0 3837 * @deprecated 4.7.0 Officially dropped security support for Netscape 4. 3838 * 3839 * @param string $string 3840 * @return string 3841 */ 3842function wp_kses_js_entities( $string ) { 3843 _deprecated_function( __FUNCTION__, '4.7.0' ); 3844 3845 return preg_replace( '%&\s*\{[^}]*(\}\s*;?|$)%', '', $string ); 3846} 3847 3848/** 3849 * Sort categories by ID. 3850 * 3851 * Used by usort() as a callback, should not be used directly. Can actually be 3852 * used to sort any term object. 3853 * 3854 * @since 2.3.0 3855 * @deprecated 4.7.0 Use wp_list_sort() 3856 * @access private 3857 * 3858 * @param object $a 3859 * @param object $b 3860 * @return int 3861 */ 3862function _usort_terms_by_ID( $a, $b ) { 3863 _deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort()' ); 3864 3865 if ( $a->term_id > $b->term_id ) 3866 return 1; 3867 elseif ( $a->term_id < $b->term_id ) 3868 return -1; 3869 else 3870 return 0; 3871} 3872 3873/** 3874 * Sort categories by name. 3875 * 3876 * Used by usort() as a callback, should not be used directly. Can actually be 3877 * used to sort any term object. 3878 * 3879 * @since 2.3.0 3880 * @deprecated 4.7.0 Use wp_list_sort() 3881 * @access private 3882 * 3883 * @param object $a 3884 * @param object $b 3885 * @return int 3886 */ 3887function _usort_terms_by_name( $a, $b ) { 3888 _deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort()' ); 3889 3890 return strcmp( $a->name, $b->name ); 3891} 3892 3893/** 3894 * Sort menu items by the desired key. 3895 * 3896 * @since 3.0.0 3897 * @deprecated 4.7.0 Use wp_list_sort() 3898 * @access private 3899 * 3900 * @global string $_menu_item_sort_prop 3901 * 3902 * @param object $a The first object to compare 3903 * @param object $b The second object to compare 3904 * @return int -1, 0, or 1 if $a is considered to be respectively less than, equal to, or greater than $b. 3905 */ 3906function _sort_nav_menu_items( $a, $b ) { 3907 global $_menu_item_sort_prop; 3908 3909 _deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort()' ); 3910 3911 if ( empty( $_menu_item_sort_prop ) ) 3912 return 0; 3913 3914 if ( ! isset( $a->$_menu_item_sort_prop ) || ! isset( $b->$_menu_item_sort_prop ) ) 3915 return 0; 3916 3917 $_a = (int) $a->$_menu_item_sort_prop; 3918 $_b = (int) $b->$_menu_item_sort_prop; 3919 3920 if ( $a->$_menu_item_sort_prop == $b->$_menu_item_sort_prop ) 3921 return 0; 3922 elseif ( $_a == $a->$_menu_item_sort_prop && $_b == $b->$_menu_item_sort_prop ) 3923 return $_a < $_b ? -1 : 1; 3924 else 3925 return strcmp( $a->$_menu_item_sort_prop, $b->$_menu_item_sort_prop ); 3926} 3927 3928/** 3929 * Retrieves the Press This bookmarklet link. 3930 * 3931 * @since 2.6.0 3932 * @deprecated 4.9.0 3933 * 3934 */ 3935function get_shortcut_link() { 3936 _deprecated_function( __FUNCTION__, '4.9.0' ); 3937 3938 $link = ''; 3939 3940 /** 3941 * Filters the Press This bookmarklet link. 3942 * 3943 * @since 2.6.0 3944 * @deprecated 4.9.0 3945 * 3946 * @param string $link The Press This bookmarklet link. 3947 */ 3948 return apply_filters( 'shortcut_link', $link ); 3949} 3950 3951/** 3952* Ajax handler for saving a post from Press This. 3953* 3954* @since 4.2.0 3955* @deprecated 4.9.0 3956*/ 3957function wp_ajax_press_this_save_post() { 3958 _deprecated_function( __FUNCTION__, '4.9.0' ); 3959 if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) { 3960 include WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php'; 3961 $wp_press_this = new WP_Press_This_Plugin(); 3962 $wp_press_this->save_post(); 3963 } else { 3964 wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) ); 3965 } 3966} 3967 3968/** 3969* Ajax handler for creating new category from Press This. 3970* 3971* @since 4.2.0 3972* @deprecated 4.9.0 3973*/ 3974function wp_ajax_press_this_add_category() { 3975 _deprecated_function( __FUNCTION__, '4.9.0' ); 3976 if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) { 3977 include WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php'; 3978 $wp_press_this = new WP_Press_This_Plugin(); 3979 $wp_press_this->add_category(); 3980 } else { 3981 wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) ); 3982 } 3983} 3984 3985/** 3986 * Return the user request object for the specified request ID. 3987 * 3988 * @since 4.9.6 3989 * @deprecated 5.4.0 Use wp_get_user_request() 3990 * @see wp_get_user_request() 3991 * 3992 * @param int $request_id The ID of the user request. 3993 * @return WP_User_Request|false 3994 */ 3995function wp_get_user_request_data( $request_id ) { 3996 _deprecated_function( __FUNCTION__, '5.4.0', 'wp_get_user_request()' ); 3997 return wp_get_user_request( $request_id ); 3998} 3999 4000/** 4001 * Filters 'img' elements in post content to add 'srcset' and 'sizes' attributes. 4002 * 4003 * @since 4.4.0 4004 * @deprecated 5.5.0 4005 * 4006 * @see wp_image_add_srcset_and_sizes() 4007 * 4008 * @param string $content The raw post content to be filtered. 4009 * @return string Converted content with 'srcset' and 'sizes' attributes added to images. 4010 */ 4011function wp_make_content_images_responsive( $content ) { 4012 _deprecated_function( __FUNCTION__, '5.5.0', 'wp_filter_content_tags()' ); 4013 4014 // This will also add the `loading` attribute to `img` tags, if enabled. 4015 return wp_filter_content_tags( $content ); 4016} 4017 4018/** 4019 * Turn register globals off. 4020 * 4021 * @since 2.1.0 4022 * @access private 4023 * @deprecated 5.5.0 4024 */ 4025function wp_unregister_GLOBALS() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid 4026 // register_globals was deprecated in PHP 5.3 and removed entirely in PHP 5.4. 4027 _deprecated_function( __FUNCTION__, '5.5.0' ); 4028} 4029 4030/** 4031 * Does comment contain disallowed characters or words. 4032 * 4033 * @since 1.5.0 4034 * @deprecated 5.5.0 Use wp_check_comment_disallowed_list() instead. 4035 * Please consider writing more inclusive code. 4036 * 4037 * @param string $author The author of the comment 4038 * @param string $email The email of the comment 4039 * @param string $url The url used in the comment 4040 * @param string $comment The comment content 4041 * @param string $user_ip The comment author's IP address 4042 * @param string $user_agent The author's browser user agent 4043 * @return bool True if comment contains disallowed content, false if comment does not 4044 */ 4045function wp_blacklist_check( $author, $email, $url, $comment, $user_ip, $user_agent ) { 4046 _deprecated_function( __FUNCTION__, '5.5.0', 'wp_check_comment_disallowed_list()' ); 4047 4048 return wp_check_comment_disallowed_list( $author, $email, $url, $comment, $user_ip, $user_agent ); 4049} 4050 4051/** 4052 * Filters out `register_meta()` args based on an allowed list. 4053 * 4054 * `register_meta()` args may change over time, so requiring the allowed list 4055 * to be explicitly turned off is a warranty seal of sorts. 4056 * 4057 * @access private 4058 * @since 4.6.0 4059 * @deprecated 5.5.0 Use _wp_register_meta_args_allowed_list() instead. 4060 * Please consider writing more inclusive code. 4061 * 4062 * @param array $args Arguments from `register_meta()`. 4063 * @param array $default_args Default arguments for `register_meta()`. 4064 * @return array Filtered arguments. 4065 */ 4066function _wp_register_meta_args_whitelist( $args, $default_args ) { 4067 _deprecated_function( __FUNCTION__, '5.5.0', '_wp_register_meta_args_allowed_list()' ); 4068 4069 return _wp_register_meta_args_allowed_list( $args, $default_args ); 4070} 4071 4072/** 4073 * Adds an array of options to the list of allowed options. 4074 * 4075 * @since 2.7.0 4076 * @deprecated 5.5.0 Use add_allowed_options() instead. 4077 * Please consider writing more inclusive code. 4078 * 4079 * @global array $allowed_options 4080 * 4081 * @param array $new_options 4082 * @param string|array $options 4083 * @return array 4084 */ 4085function add_option_whitelist( $new_options, $options = '' ) { 4086 _deprecated_function( __FUNCTION__, '5.5.0', 'add_allowed_options()' ); 4087 4088 return add_allowed_options( $new_options, $options ); 4089} 4090 4091/** 4092 * Removes a list of options from the allowed options list. 4093 * 4094 * @since 2.7.0 4095 * @deprecated 5.5.0 Use remove_allowed_options() instead. 4096 * Please consider writing more inclusive code. 4097 * 4098 * @global array $allowed_options 4099 * 4100 * @param array $del_options 4101 * @param string|array $options 4102 * @return array 4103 */ 4104function remove_option_whitelist( $del_options, $options = '' ) { 4105 _deprecated_function( __FUNCTION__, '5.5.0', 'remove_allowed_options()' ); 4106 4107 return remove_allowed_options( $del_options, $options ); 4108} 4109 4110/** 4111 * Adds slashes to only string values in an array of values. 4112 * 4113 * This should be used when preparing data for core APIs that expect slashed data. 4114 * This should not be used to escape data going directly into an SQL query. 4115 * 4116 * @since 5.3.0 4117 * @deprecated 5.6.0 Use wp_slash() 4118 * 4119 * @see wp_slash() 4120 * 4121 * @param mixed $value Scalar or array of scalars. 4122 * @return mixed Slashes $value 4123 */ 4124function wp_slash_strings_only( $value ) { 4125 return map_deep( $value, 'addslashes_strings_only' ); 4126} 4127 4128/** 4129 * Adds slashes only if the provided value is a string. 4130 * 4131 * @since 5.3.0 4132 * @deprecated 5.6.0 4133 * 4134 * @see wp_slash() 4135 * 4136 * @param mixed $value 4137 * @return mixed 4138 */ 4139function addslashes_strings_only( $value ) { 4140 return is_string( $value ) ? addslashes( $value ) : $value; 4141} 4142 4143/** 4144 * Displays a noindex meta tag if required by the blog configuration. 4145 * 4146 * If a blog is marked as not being public then the noindex meta tag will be 4147 * output to tell web robots not to index the page content. Add this to the 4148 * {@see 'wp_head'} action. 4149 * 4150 * Typical usage is as a {@see 'wp_head'} callback: 4151 * 4152 * add_action( 'wp_head', 'noindex' ); 4153 * 4154 * @see wp_no_robots() 4155 * 4156 * @since 2.1.0 4157 * @deprecated 5.7.0 Use wp_robots_noindex() instead on 'wp_robots' filter. 4158 */ 4159function noindex() { 4160 _deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_noindex()' ); 4161 4162 // If the blog is not public, tell robots to go away. 4163 if ( '0' == get_option( 'blog_public' ) ) { 4164 wp_no_robots(); 4165 } 4166} 4167 4168/** 4169 * Display a noindex meta tag. 4170 * 4171 * Outputs a noindex meta tag that tells web robots not to index the page content. 4172 * Typical usage is as a {@see 'wp_head'} callback. add_action( 'wp_head', 'wp_no_robots' ); 4173 * 4174 * @since 3.3.0 4175 * @since 5.3.0 Echo "noindex,nofollow" if search engine visibility is discouraged. 4176 * @deprecated 5.7.0 Use wp_robots_no_robots() instead on 'wp_robots' filter. 4177 */ 4178function wp_no_robots() { 4179 _deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_no_robots()' ); 4180 4181 if ( get_option( 'blog_public' ) ) { 4182 echo "<meta name='robots' content='noindex,follow' />\n"; 4183 return; 4184 } 4185 4186 echo "<meta name='robots' content='noindex,nofollow' />\n"; 4187} 4188 4189/** 4190 * Display a noindex,noarchive meta tag and referrer origin-when-cross-origin meta tag. 4191 * 4192 * Outputs a noindex,noarchive meta tag that tells web robots not to index or cache the page content. 4193 * Outputs a referrer origin-when-cross-origin meta tag that tells the browser not to send the full 4194 * url as a referrer to other sites when cross-origin assets are loaded. 4195 * 4196 * Typical usage is as a wp_head callback. add_action( 'wp_head', 'wp_sensitive_page_meta' ); 4197 * 4198 * @since 5.0.1 4199 * @deprecated 5.7.0 Use wp_robots_sensitive_page() instead on 'wp_robots' filter 4200 * and wp_strict_cross_origin_referrer() on 'wp_head' action. 4201 */ 4202function wp_sensitive_page_meta() { 4203 _deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_sensitive_page()' ); 4204 4205 ?> 4206 <meta name='robots' content='noindex,noarchive' /> 4207 <?php 4208 wp_strict_cross_origin_referrer(); 4209} 4210 4211/** 4212 * Render inner blocks from the `core/columns` block for generating an excerpt. 4213 * 4214 * @since 5.2.0 4215 * @deprecated 5.8.0 4216 * 4217 * @access private 4218 * 4219 * @param array $columns The parsed columns block. 4220 * @param array $allowed_blocks The list of allowed inner blocks. 4221 * @return string The rendered inner blocks. 4222 */ 4223function _excerpt_render_inner_columns_blocks( $columns, $allowed_blocks ) { 4224 _deprecated_function( __FUNCTION__, '5.8.0', '_excerpt_render_inner_blocks()' ); 4225 return _excerpt_render_inner_blocks( $columns, $allowed_blocks ); 4226} 4227