deprecated.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <?php
  2. // Register deprecated filters ( $deprecated, $version, $replacement ).
  3. acf_add_deprecated_filter( 'acf/settings/export_textdomain', '5.3.3', 'acf/settings/l10n_textdomain' );
  4. acf_add_deprecated_filter( 'acf/settings/export_translate', '5.3.3', 'acf/settings/l10n_field' );
  5. acf_add_deprecated_filter( 'acf/settings/export_translate', '5.3.3', 'acf/settings/l10n_field_group' );
  6. acf_add_deprecated_filter( 'acf/settings/dir', '5.6.8', 'acf/settings/url' );
  7. acf_add_deprecated_filter( 'acf/get_valid_field', '5.5.6', 'acf/validate_field' );
  8. acf_add_deprecated_filter( 'acf/get_valid_field_group', '5.5.6', 'acf/validate_field_group' );
  9. acf_add_deprecated_filter( 'acf/get_valid_post_id', '5.5.6', 'acf/validate_post_id' );
  10. acf_add_deprecated_filter( 'acf/get_field_reference', '5.6.5', 'acf/load_reference' );
  11. acf_add_deprecated_filter( 'acf/get_field_group', '5.7.11', 'acf/load_field_group' );
  12. acf_add_deprecated_filter( 'acf/get_field_groups', '5.7.11', 'acf/load_field_groups' );
  13. acf_add_deprecated_filter( 'acf/get_fields', '5.7.11', 'acf/load_fields' );
  14. // Register variations for deprecated filters.
  15. acf_add_filter_variations( 'acf/get_valid_field', array( 'type' ), 0 );
  16. /**
  17. * acf_render_field_wrap_label
  18. *
  19. * Renders the field's label.
  20. *
  21. * @date 19/9/17
  22. * @since 5.6.3
  23. * @deprecated 5.6.5
  24. *
  25. * @param array $field The field array.
  26. * @return void
  27. */
  28. function acf_render_field_wrap_label( $field ) {
  29. // Warning.
  30. _deprecated_function( __FUNCTION__, '5.7.11', 'acf_render_field_label()' );
  31. // Render.
  32. acf_render_field_label( $field );
  33. }
  34. /**
  35. * acf_render_field_wrap_description
  36. *
  37. * Renders the field's instructions.
  38. *
  39. * @date 19/9/17
  40. * @since 5.6.3
  41. * @deprecated 5.6.5
  42. *
  43. * @param array $field The field array.
  44. * @return void
  45. */
  46. function acf_render_field_wrap_description( $field ) {
  47. // Warning.
  48. _deprecated_function( __FUNCTION__, '5.7.11', 'acf_render_field_instructions()' );
  49. // Render.
  50. acf_render_field_instructions( $field );
  51. }
  52. /*
  53. * acf_get_fields_by_id
  54. *
  55. * Returns and array of fields for the given $parent_id.
  56. *
  57. * @date 27/02/2014
  58. * @since 5.0.0.
  59. * @deprecated 5.7.11
  60. *
  61. * @param int $parent_id The parent ID.
  62. * @return array
  63. */
  64. function acf_get_fields_by_id( $parent_id = 0 ) {
  65. // Warning.
  66. _deprecated_function( __FUNCTION__, '5.7.11', 'acf_get_fields()' );
  67. // Return fields.
  68. return acf_get_fields(
  69. array(
  70. 'ID' => $parent_id,
  71. 'key' => "group_$parent_id",
  72. )
  73. );
  74. }
  75. /**
  76. * acf_update_option
  77. *
  78. * A wrapper for the WP update_option but provides logic for a 'no' autoload
  79. *
  80. * @date 4/01/2014
  81. * @since 5.0.0
  82. * @deprecated 5.7.11
  83. *
  84. * @param string $option The option name.
  85. * @param string $value The option value.
  86. * @param string $autoload An optional autoload value.
  87. * @return bool
  88. */
  89. function acf_update_option( $option = '', $value = '', $autoload = null ) {
  90. // Warning.
  91. _deprecated_function( __FUNCTION__, '5.7.11', 'update_option()' );
  92. // Update.
  93. if ( $autoload === null ) {
  94. $autoload = (bool) acf_get_setting( 'autoload' );
  95. }
  96. return update_option( $option, $value, $autoload );
  97. }
  98. /**
  99. * acf_get_field_reference
  100. *
  101. * Finds the field key for a given field name and post_id.
  102. *
  103. * @date 26/1/18
  104. * @since 5.6.5
  105. * @deprecated 5.6.8
  106. *
  107. * @param string $field_name The name of the field. eg 'sub_heading'
  108. * @param mixed $post_id The post_id of which the value is saved against
  109. * @return string $reference The field key
  110. */
  111. function acf_get_field_reference( $field_name, $post_id ) {
  112. // Warning.
  113. _deprecated_function( __FUNCTION__, '5.6.8', 'acf_get_reference()' );
  114. // Return reference.
  115. return acf_get_reference( $field_name, $post_id );
  116. }
  117. /**
  118. * acf_get_dir
  119. *
  120. * Returns the plugin url to a specified file.
  121. *
  122. * @date 28/09/13
  123. * @since 5.0.0
  124. * @deprecated 5.6.8
  125. *
  126. * @param string $filename The specified file.
  127. * @return string
  128. */
  129. function acf_get_dir( $filename = '' ) {
  130. // Warning.
  131. _deprecated_function( __FUNCTION__, '5.6.8', 'acf_get_url()' );
  132. // Return.
  133. return acf_get_url( $filename );
  134. }