Support » Plugin: Gravity Forms + Custom Post Types » [Plugin: Gravity Forms Custom Post Types] Custom Meta fields not showing in custom filed name

Viewing 3 replies - 1 through 3 (of 3 total)
  • Just to add… I have published a post (of the custom post type) that makes use of all custom meta boxes/fields…

    madebymartin,

    I’m using Custom Metaboxes and Fields as well, and at first I was adding an underscore to the field IDs to hide them from the post editor custom fields, but that hides the metaboxes from Gravity Forms too. Remove the underscore and you should see them in Gravity Forms.

    Yes, custom meta boxes uses the prefix _cmb_ to hide the fields from custom field list in post editor. They’re saved, they just dont show in list. This is commented fairly well in the example-functions file that is included with CMB.

    Like John says, just delete that underscore before CMB in the file you use to register the meta boxes, and then again if you’re calling the boxes to be seen on the front end – like in a template page.

    If anyone else is looking at this and thinking “I did all that but the fields are still not showing in my custom post type” make sure that your custom post type is registered to support custom fields.

    That line in your custom post registration code will be like this:

    <?php
    
    add_action( 'init', 'register_cpt_careerops' );
    
    function register_cpt_careerops() {
    
        $labels = array(
            'name' => _x( 'Career Opportunities', 'careerops' ),
            'singular_name' => _x( 'Career Opportunity', 'careerops' ),
            'add_new' => _x( 'Add New', 'careerops' ),
            'add_new_item' => _x( 'Add New Career Opportunity', 'careerops' ),
            'edit_item' => _x( 'Edit Career Opportunity', 'careerops' ),
            'new_item' => _x( 'New Career Opportunity', 'careerops' ),
            'view_item' => _x( 'View Career Opportunity', 'careerops' ),
            'search_items' => _x( 'Search Career Opportunities', 'careerops' ),
            'not_found' => _x( 'No career opportunities found', 'careerops' ),
            'not_found_in_trash' => _x( 'No career opportunities found in Trash', 'careerops' ),
            'parent_item_colon' => _x( 'Parent Career Opportunity:', 'careerops' ),
            'menu_name' => _x( 'Career Opportunities', 'careerops' ),
        );
    
        $args = array(
            'labels' => $labels,
            'hierarchical' => false,
    
            'supports' => array( 'title', 'author', 'revisions', 'page-attributes','custom-fields' ),
    
            'public' => true,
            'show_ui' => true,
            'show_in_menu' => true,
            'menu_position' => 5,
    
            'show_in_nav_menus' => true,
            'publicly_queryable' => true,
            'exclude_from_search' => false,
            'has_archive' => true,
            'query_var' => true,
            'can_export' => true,
            'rewrite' => true,
            'capability_type' => 'post'
        );
    
        register_post_type( 'careerops', $args );
    }
    ?>

    Third line in the $arg array starts with support. make sure custom-fields is in there.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Gravity Forms Custom Post Types] Custom Meta fields not showing in custom filed name’ is closed to new replies.