PluginProbe ʕ •ᴥ•ʔ
Secure Custom Fields / 6.9.1
Secure Custom Fields v6.9.1
6.9.1 6.9.0 6.8.9 6.8.7 6.8.8 6.8.6 6.8.4 6.8.5 trunk 6.4.0-beta1 6.4.0-beta2 6.4.1 6.4.1-beta3 6.4.1-beta4 6.4.1-beta5 6.4.1-beta6 6.4.1-beta7 6.4.2 6.5.0 6.5.1 6.5.2 6.5.3 6.5.4 6.5.5 6.5.6 6.5.7 6.6.0 6.7.0 6.7.1 6.8.0 6.8.1 6.8.2 6.8.3
secure-custom-fields / includes / acf-taxonomy-functions.php
secure-custom-fields / includes Last commit date
Blocks 1 week ago Datastore 1 month ago Meta 1 year ago abilities 1 week ago admin 1 week ago ajax 1 month ago api 2 days ago fields 2 days ago forms 2 days ago legacy 1 year ago locations 1 year ago post-types 2 months ago rest-api 1 week ago walkers 1 year ago acf-bidirectional-functions.php 1 year ago acf-field-functions.php 2 months ago acf-field-group-functions.php 7 months ago acf-form-functions.php 1 year ago acf-helper-functions.php 1 year ago acf-hook-functions.php 1 year ago acf-input-functions.php 7 months ago acf-internal-post-type-functions.php 7 months ago acf-meta-functions.php 3 weeks ago acf-post-functions.php 1 year ago acf-post-type-functions.php 1 year ago acf-taxonomy-functions.php 1 year ago acf-user-functions.php 1 week ago acf-utility-functions.php 1 year ago acf-value-functions.php 1 year ago acf-wp-functions.php 2 days ago assets.php 1 week ago blocks-auto-inline-editing.php 2 months ago blocks.php 3 weeks ago class-acf-data.php 10 months ago class-acf-internal-post-type.php 1 week ago class-acf-options-page.php 1 year ago class-acf-site-health.php 3 months ago class-scf-json-schema-validator.php 6 months ago class-scf-schema-builder.php 2 months ago compatibility.php 1 year ago datastore.php 1 month ago deprecated.php 1 year ago fields.php 10 months ago index.php 1 year ago l10n.php 1 year ago local-fields.php 1 year ago local-json.php 1 month ago local-meta.php 1 year ago locations.php 1 year ago loop.php 10 months ago media.php 1 year ago rest-api.php 10 months ago revisions.php 1 month ago scf-ui-options-page-functions.php 1 year ago third-party.php 7 months ago upgrades.php 3 weeks ago validation.php 10 months ago wpml.php 1 year ago
acf-taxonomy-functions.php
269 lines
1 <?php
2 /**
3 * Functions for ACF taxonomy objects.
4 *
5 * @package wordpress/secure-custom-fields
6 */
7
8 /**
9 * Get an ACF taxonomy as an array
10 *
11 * @param integer|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 ACF 6.1
22 *
23 * @param integer|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 ACF 6.1
34 *
35 * @param integer|string $id The post ID, key, or name.
36 * @return object|boolean 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 ACF 6.1
46 *
47 * @param string $id The identifier.
48 * @return boolean
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 ACF 6.1
58 *
59 * @param array $taxonomy The ACF taxonomy array.
60 * @return array|boolean
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 ACF 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 ACF 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 ACF 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 ACF 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 ACF 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 ACF 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 ACF 6.1
142 *
143 * @param integer|string $id The ACF taxonomy ID, key or name.
144 * @return boolean 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 ACF 6.1
154 *
155 * @param integer|string $id The taxonomy ID, key, or name.
156 * @return boolean 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 ACF 6.1
166 *
167 * @param integer|string $id The taxonomy ID, key, or name.
168 * @return boolean 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 ACF 6.1
178 *
179 * @param array $taxonomy The ACF taxonomy array.
180 * @return boolean
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 ACF 6.1
190 *
191 * @param integer|string $id The ACF taxonomy ID, key or name.
192 * @param integer $new_post_id Optional ID to override.
193 * @return array|boolean 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 integer|string $id The ACF taxonomy ID, key or name.
203 * @param boolean $activate True if the taxonomy should be activated.
204 * @return boolean
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 ACF 6.1
214 *
215 * @param integer $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 ACF 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 ACF 6.1
238 *
239 * @param array $taxonomy The ACF taxonomy array.
240 * @return string|boolean
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 ACF 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 ACF 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