Register Post Meta.
This function should only be invoked through the ‘admin_init’ action.
beans_register_post_meta( $fields, $conditions, $section, $args = array() )
Source
function beans_register_post_meta( array $fields, $conditions, $section, $args = array() ) {
global $_beans_post_meta_conditions;
/**
* Filter the post 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 post meta fields.
*/
$fields = apply_filters( "beans_post_meta_fields_{$section}", _beans_pre_standardize_fields( $fields ) );
/**
* Filter the conditions 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 $conditions Conditions used to define whether the fields set should be displayed or not.
*/
$conditions = apply_filters( "beans_post_meta_post_types_{$section}", $conditions );
$_beans_post_meta_conditions = array_merge( $_beans_post_meta_conditions, (array) $conditions );
// Stop here if the current page isn't concerned.
if ( ! _beans_is_post_meta_conditions( $conditions ) || ! is_admin() ) {
return;
}
// Stop here if the field can't be registered.
if ( ! beans_register_fields( $fields, 'post_meta', $section ) ) {
return false;
}
// Load the class only if this function is called to prevent unnecessary memory usage.
require_once( BEANS_API_PATH . 'post-meta/class.php' );
new _Beans_Post_Meta( $section, $args );
}