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.3.4 4.3.5 4.3.6 4.3.7 4.3.8 4.3.9 4.4.0 4.4.1 4.4.10 4.4.11 4.4.12 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 5.10 5.10.1 5.10.2 5.11 5.11.1 5.11.2 5.11.3 5.11.4 5.12 5.12.1 5.12.2 5.12.3 5.12.4 5.12.5 5.12.6 5.6.10 5.6.2 5.6.3 5.6.4 5.6.5 5.6.6 5.6.7 5.6.8 5.6.9 5.7.0 5.7.1 5.7.10 5.7.12 5.7.13 5.7.2 5.7.3 5.7.4 5.7.5 5.7.6 5.7.7 5.7.8 5.7.9 5.8.0 5.8.1 5.8.10 5.8.11 5.8.12 5.8.13 5.8.14 5.8.2 5.8.3 5.8.4
advanced-custom-fields / includes / acf-taxonomy-functions.php
advanced-custom-fields / includes Last commit date
admin 2 years ago ajax 3 years ago api 2 years ago fields 2 years ago forms 2 years ago legacy 4 years ago locations 3 years ago post-types 2 years ago rest-api 3 years ago walkers 2 years ago acf-bidirectional-functions.php 2 years ago acf-field-functions.php 3 years ago acf-field-group-functions.php 3 years ago acf-form-functions.php 3 years ago acf-helper-functions.php 2 years ago acf-hook-functions.php 4 years ago acf-input-functions.php 3 years ago acf-internal-post-type-functions.php 2 years ago acf-meta-functions.php 3 years ago acf-post-functions.php 4 years ago acf-post-type-functions.php 2 years ago acf-taxonomy-functions.php 3 years ago acf-user-functions.php 4 years ago acf-utility-functions.php 3 years ago acf-value-functions.php 2 years ago acf-wp-functions.php 2 years ago assets.php 2 years ago class-acf-data.php 3 years ago class-acf-internal-post-type.php 2 years ago compatibility.php 4 years ago deprecated.php 4 years ago fields.php 2 years ago l10n.php 3 years ago local-fields.php 2 years ago local-json.php 2 years ago local-meta.php 4 years ago locations.php 3 years ago loop.php 3 years ago media.php 3 years ago rest-api.php 4 years ago revisions.php 3 years ago third-party.php 3 years ago upgrades.php 3 years ago validation.php 2 years ago wpml.php 3 years ago
acf-taxonomy-functions.php
269 lines
1 <?php
2 /**
3 * Functions for ACF taxonomy objects.
4 *
5 * @package ACF
6 */
7
8 /**
9 * Get an ACF taxonomy as an array
10 *
11 * @param int|string $id The post ID being queried.
12 * @return array|false The taxonomy object.
13 */
14 function acf_get_taxonomy( $id ) {
15 return acf_get_internal_post_type( $id, 'acf-taxonomy' );
16 }
17
18 /**
19 * Retrieves a raw ACF taxonomy.
20 *
21 * @since 6.1
22 *
23 * @param int|string $id The post ID.
24 * @return array|false The taxonomy array.
25 */
26 function acf_get_raw_taxonomy( $id ) {
27 return acf_get_raw_internal_post_type( $id, 'acf-taxonomy' );
28 }
29
30 /**
31 * Gets a post object for an ACF taxonomy.
32 *
33 * @since 6.1
34 *
35 * @param int|string $id The post ID, key, or name.
36 * @return object|bool The post object, or false on failure.
37 */
38 function acf_get_taxonomy_post( $id ) {
39 return acf_get_internal_post_type_post( $id, 'acf-taxonomy' );
40 }
41
42 /**
43 * Returns true if the given identifier is an ACF taxonomy key.
44 *
45 * @since 6.1
46 *
47 * @param string $id The identifier.
48 * @return bool
49 */
50 function acf_is_taxonomy_key( $id ) {
51 return acf_is_internal_post_type_key( $id, 'acf-taxonomy' );
52 }
53
54 /**
55 * Validates an ACF taxonomy.
56 *
57 * @since 6.1
58 *
59 * @param array $taxonomy The ACF taxonomy array.
60 * @return array|bool
61 */
62 function acf_validate_taxonomy( array $taxonomy = array() ) {
63 return acf_validate_internal_post_type( $taxonomy, 'acf-taxonomy' );
64 }
65
66 /**
67 * Translates the settings for an ACF taxonomy.
68 *
69 * @since 6.1
70 *
71 * @param array $taxonomy The ACF taxonomy array.
72 * @return array
73 */
74 function acf_translate_taxonomy( array $taxonomy ) {
75 return acf_translate_internal_post_type( $taxonomy, 'acf-taxonomy' );
76 }
77
78 /**
79 * Returns an array of ACF taxonomies for the given $filter.
80 *
81 * @since 6.1
82 *
83 * @param array $filter An array of args to filter results by.
84 * @return array
85 */
86 function acf_get_acf_taxonomies( array $filter = array() ) {
87 return acf_get_internal_post_type_posts( 'acf-taxonomy', $filter );
88 }
89
90 /**
91 * Returns an array of raw ACF taxonomies.
92 *
93 * @since 6.1
94 *
95 * @return array
96 */
97 function acf_get_raw_taxonomies() {
98 return acf_get_raw_internal_post_type_posts( 'acf-taxonomy' );
99 }
100
101 /**
102 * Returns a filtered array of ACF taxonomies based on the given $args.
103 *
104 * @since 6.1
105 *
106 * @param array $taxonomies An array of ACF taxonomies.
107 * @param array $args An array of args to filter by.
108 * @return array
109 */
110 function acf_filter_taxonomies( array $taxonomies, array $args = array() ) {
111 return acf_filter_internal_post_type_posts( $taxonomies, $args, 'acf-taxonomy' );
112 }
113
114 /**
115 * Updates an ACF taxonomy in the database.
116 *
117 * @since 6.1
118 *
119 * @param array $taxonomy The main ACF taxonomy array.
120 * @return array
121 */
122 function acf_update_taxonomy( array $taxonomy ) {
123 return acf_update_internal_post_type( $taxonomy, 'acf-taxonomy' );
124 }
125
126 /**
127 * Deletes all caches for the provided ACF taxonomy.
128 *
129 * @since 6.1
130 *
131 * @param array $taxonomy The ACF taxonomy array.
132 * @return void
133 */
134 function acf_flush_taxonomy_cache( array $taxonomy ) {
135 acf_flush_internal_post_type_cache( $taxonomy, 'acf-taxonomy' );
136 }
137
138 /**
139 * Deletes an ACF taxonomy from the database.
140 *
141 * @since 6.1
142 *
143 * @param int|string $id The ACF taxonomy ID, key or name.
144 * @return bool True if taxonomy was deleted.
145 */
146 function acf_delete_taxonomy( $id = 0 ) {
147 return acf_delete_internal_post_type( $id, 'acf-taxonomy' );
148 }
149
150 /**
151 * Trashes an ACF taxonomy.
152 *
153 * @since 6.1
154 *
155 * @param int|string $id The taxonomy ID, key, or name.
156 * @return bool True if taxonomy was trashed.
157 */
158 function acf_trash_taxonomy( $id = 0 ) {
159 return acf_trash_internal_post_type( $id, 'acf-taxonomy' );
160 }
161
162 /**
163 * Restores an ACF taxonomy from the trash.
164 *
165 * @since 6.1
166 *
167 * @param int|string $id The taxonomy ID, key, or name.
168 * @return bool True if taxonomy was untrashed.
169 */
170 function acf_untrash_taxonomy( $id = 0 ) {
171 return acf_untrash_internal_post_type( $id, 'acf-taxonomy' );
172 }
173
174 /**
175 * Returns true if the given params match an ACF taxonomy.
176 *
177 * @since 6.1
178 *
179 * @param array $taxonomy The ACF taxonomy array.
180 * @return bool
181 */
182 function acf_is_taxonomy( $taxonomy ) {
183 return acf_is_internal_post_type( $taxonomy, 'acf-taxonomy' );
184 }
185
186 /**
187 * Duplicates an ACF taxonomy.
188 *
189 * @since 6.1
190 *
191 * @param int|string $id The ACF taxonomy ID, key or name.
192 * @param int $new_post_id Optional ID to override.
193 * @return array|bool The new ACF taxonomy, or false on failure.
194 */
195 function acf_duplicate_taxonomy( $id = 0, $new_post_id = 0 ) {
196 return acf_duplicate_internal_post_type( $id, $new_post_id, 'acf-taxonomy' );
197 }
198
199 /**
200 * Activates or deactivates an ACF taxonomy.
201 *
202 * @param int|string $id The ACF taxonomy ID, key or name.
203 * @param bool $activate True if the taxonomy should be activated.
204 * @return bool
205 */
206 function acf_update_taxonomy_active_status( $id, $activate = true ) {
207 return acf_update_internal_post_type_active_status( $id, $activate, 'acf-taxonomy' );
208 }
209
210 /**
211 * Checks if the current user can edit the taxonomy and returns the edit url.
212 *
213 * @since 6.1
214 *
215 * @param int $post_id The ACF taxonomy ID.
216 * @return string
217 */
218 function acf_get_taxonomy_edit_link( $post_id ) {
219 return acf_get_internal_post_type_edit_link( $post_id, 'acf-taxonomy' );
220 }
221
222 /**
223 * Returns a modified ACF taxonomy ready for export.
224 *
225 * @since 6.1
226 *
227 * @param array $taxonomy The ACF taxonomy array.
228 * @return array
229 */
230 function acf_prepare_taxonomy_for_export( array $taxonomy = array() ) {
231 return acf_prepare_internal_post_type_for_export( $taxonomy, 'acf-taxonomy' );
232 }
233
234 /**
235 * Exports an ACF taxonomy as PHP.
236 *
237 * @since 6.1
238 *
239 * @param array $taxonomy The ACF taxonomy array.
240 * @return string|bool
241 */
242 function acf_export_taxonomy_as_php( array $taxonomy ) {
243 return acf_export_internal_post_type_as_php( $taxonomy, 'acf-taxonomy' );
244 }
245
246 /**
247 * Prepares an ACF taxonomy for the import process.
248 *
249 * @since 6.1
250 *
251 * @param array $taxonomy The ACF taxonomy array.
252 * @return array
253 */
254 function acf_prepare_taxonomy_for_import( array $taxonomy = array() ) {
255 return acf_prepare_internal_post_type_for_import( $taxonomy, 'acf-taxonomy' );
256 }
257
258 /**
259 * Imports an ACF taxonomy into the database.
260 *
261 * @since 6.1
262 *
263 * @param array $taxonomy The ACF taxonomy array.
264 * @return array The imported taxonomy.
265 */
266 function acf_import_taxonomy( array $taxonomy ) {
267 return acf_import_internal_post_type( $taxonomy, 'acf-taxonomy' );
268 }
269