Register Term Meta.
This function should only be invoked through the ‘admin_init’ action.
beans_register_term_meta( $fields, $taxonomies, $section )
Source
function beans_register_term_meta( array $fields, $taxonomies, $section ) {
/**
* Filter the term meta fields.
*
* The dynamic portion of the hook name, $section, refers to the section id which defines the group of fields.
*
* @since 1.0.0
*
* @param array $fields An array of term meta fields.
*/
$fields = apply_filters( "beans_term_meta_fields_{$section}", _beans_pre_standardize_fields( $fields ) );
/**
* Filter the taxonomies used to define whether the fields set should be displayed or not.
*
* The dynamic portion of the hook name, $section, refers to the section id which defines the group of fields.
*
* @since 1.0.0
*
* @param string|array $taxonomies Taxonomies used to define whether the fields set should be displayed or not.
*/
$taxonomies = apply_filters( "beans_term_meta_taxonomies_{$section}", (array) $taxonomies );
// Stop here if the current page isn't concerned.
if ( ! _beans_is_admin_term( $taxonomies ) || ! is_admin() ) {
return;
}
// Stop here if the field can't be registered.
if ( ! beans_register_fields( $fields, 'term_meta', $section ) ) {
return false;
}
// Load the class only if this function is called to prevent unnecessary memory usage.
require_once( BEANS_API_PATH . 'term-meta/class.php' );
new _Beans_Term_Meta( $section );
}