• Skip to the primary navigation.
  • Skip to the content.
Beans Theme Framework
Menu
  • Themes
  • Showcase
  • Docs
  • Support
  • Community
  • Documentation
  • Code snippets
  • Code reference

beans_register_post_meta

    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 );
    
    }
    
    Filters

    Code reference categories

    • Admin
    • Initialize
    • Assets
    • Render
    • Structure
    • API
      • Actions
      • Compiler
      • Fields
      • Filters
      • HTML
      • Image
      • Layout
      • Options
      • Post Meta
      • Templates
      • Term Meta
      • UIkit
      • Utilities
      • Widgets
      • WP Customize
    • Fragments

    Get notified when new stuff is released, and more...

    Here at BeansPress, we roast hot code on a weekly basis. Follow us on Twitter to make sure you don't miss anything!

    Follow @BeansPress

    “If you haven't found the magic in Beans, you haven't looked far enough!”

    © Beans  |  Contact  |  DonateFounded by Thierry Muller, co-maintained by Tonya Mork
    Beans project is no longer maintained, thanks for your support for so many years. Stay awesome!