Custom Fields
Support MB Settings Page user editable post type description

  • Creator
  • #28592
    Resolved Aaron Kessler

    I am trying to make the post type description user editable. While I am able to access the settings-page data via rwmb_meta('_prefix_classic_editor', ['object_type' => 'setting'], 'posttype_description') inside a template like archive.php, I can't inside my register post types function like so:

    function prefix_register_post_types()
        $cpt_labels = [...];
        register_post_type('cpt', [
            'label' => esc_html__('cpts', '_textdomain'),
            'labels' => $cpt_labels,
            'description' => rwmb_meta('prefix_classic_editor', ['object_type' => 'setting'], 'posttype_description'),
            'public' => true,
            'hierarchical' => false,
            'exclude_from_search' => false,
            'publicly_queryable' => true,
            'show_ui' => true,
            'show_in_nav_menus' => true,
            'show_in_admin_bar' => true,
            'show_in_rest' => true,
            'query_var' => true,
            'can_export' => true,
            'delete_with_user' => true,
            'has_archive' => true,
            'rest_base' => '',
            'show_in_menu' => true,
            'menu_icon' => 'dashicons-awards',
            'menu_position' => 5,
            'capability_type' => 'post',
            'supports' => ['title', 'editor', 'thumbnail', 'excerpt'],
            'taxonomies' => [],
            'rewrite' => [
                'with_front' => false,
    add_action('init', 'prefix_register_post_types');

    any idea on how to accomplish this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
  • #28597
    Long Nguyen


    The Meta Box core class hooks to the action init with the priority 20 after register the post type so the helper function rwmb_meta() does not work. You can use the WordPress function get_option() to get the settings page value.

    Aaron Kessler

    This worked, thx a lot.
    The documention does not mention a usecase like this, where we can't use rwmb_meta(), but get_option()

    Long Nguyen


    Thanks for your feedback.

    I will update the documentation to explain this case.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.