Custom Fields
Re-Envisioned
Support MB Custom Table Custom model - Position in Menu

  • Creator
    Topic
  • #30725
    hlikes
    Participant

    Hi, I am following the docs here: https://docs.metabox.io/extensions/mb-custom-table/#custom-models

    But not sure about what to specify for the "parent" parameter, which is described as "if you want to show model as a sub-menu". What do I need to specify if I want to place the link under an existing menu?

    Thanks,
    M.

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #30730
    Long Nguyen
    Moderator

    Hi,

    It works like the sub-menu page in WordPress

    The slug name for the parent menu (or the file name of a standard WordPress admin page)

    For example, if you want to show the transaction under the Page menu, assign the setting parent to this slug edit.php?post_type=page

    function prefix_register_transaction_model() {
        mb_register_model( 'transaction', [
            'table'  => 'transactions',
            'labels' => [
                'name'          => 'Transactions',
                'singular_name' => 'Transaction',
            ],
            'menu_icon' => 'dashicons-money-alt',
            'parent' => 'edit.php?post_type=page'
        ] );
    }

    Get more details on the documentation
    https://developer.wordpress.org/reference/functions/add_submenu_page/#user-contributed-notes

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