📌  相关文章
📜  使用 ACF 的 wordpress 自定义菜单选项页面 - 任何代码示例

📅  最后修改于: 2022-03-11 14:59:18.697000             🧑  作者: Mango

代码示例1
//Page  Options (only work with ACF Pro)

if( function_exists('acf_add_options_page') ) {
    
    acf_add_options_page(array(
        'page_title'     => 'YOUR OPTION PAGE NAME',
        'menu_title'    => 'YOUR OPTION PAGE NAME',
        'menu_slug'     => 'your-option-page-name',
        'capability'    => 'edit_posts',
        'redirect'        => false
    ));

//This is Sub menu if you need you can use

    acf_add_options_sub_page(array(
        'page_title'     => 'YOUR SUB MENU 1 NAME',
        'menu_title'    => 'YOUR SUB MENU 1 NAME',
        'parent_slug'    => 'your-option-page-name',
    ));

    acf_add_options_sub_page(array(
        'page_title'     => 'YOUR SUB MENU 2 NAME',
        'menu_title'    => 'YOUR SUB MENU 2 NAME',
        'parent_slug'    => 'your-option-page-name',
    ));
    
}

// CHANGE only CAPITALIZE TEXT and "MENU_SLUG" according your desire as sample code