Remove taxonomies that you probably won't need, and take forever to load all the terms in ACF taxonomy field.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Remove taxonomies that you probably won't need, and take forever to load all the terms in ACF taxonomy field. | |
* | |
* @version 1.0.0 | |
* @author @JiveDig | |
* @uses Advanced Custom Fields | |
* | |
* @param array $taxonomies The existing taxonomies. | |
* @param array $args An array of args used in the get_taxonomies() function. | |
* | |
* @return array The modified array of taxonomy names. | |
*/ | |
add_filter( 'acf/get_taxonomies', function( $taxonomies, $args ) { | |
// Array of taxonomies to remove. | |
$remove = array( | |
'post_tag', | |
'post_format', | |
'yst_prominent_words', | |
); | |
// Loop through em. | |
foreach ( $remove as $taxonomy ) { | |
// Remove them from the options. | |
$taxonomies = array_diff( $taxonomies, array( $taxonomy ) ); | |
} | |
return $taxonomies; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment