Skip to content

Instantly share code, notes, and snippets.

@JiveDig
Last active May 20, 2019 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JiveDig/2d31cf68efcffa645de302a04e7f5176 to your computer and use it in GitHub Desktop.
Save JiveDig/2d31cf68efcffa645de302a04e7f5176 to your computer and use it in GitHub Desktop.
Remove taxonomies that you probably won't need, and take forever to load all the terms in ACF taxonomy field.
<?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