Home Forums Themes Support How to show Page Options with only Administrator

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #9123

    Hi all customer,

    Thanks so much for choosing our product!

    In this topic tutorial we’ll help you show Page Options (use MetaBox plugin) for administrator permission only.

    This tutorial not use for new Framework build for Elementor, this tutorial use for old Framework use WPBakery Page Builder.

    Step 1: Go to wp-content/themes/xxx/framework/include then open file theme-metabox.php (xxx is theme name as clarivo, circle, formota,…)

    For easy to edit files you can use this plugin:

    File Manager

    Step 2: go to line 871 and change the code from

    add_action( 'admin_init', 'haru_load_rw_custom_fields', 1 ); // Use this for back-end
    add_action( 'rwmb_meta_boxes', 'haru_load_rw_custom_fields', 1 ); // Use this for front-end @TODO: do not know now

    to

    if ( current_user_can( 'manage_options' ) ) {
    add_action( 'admin_init', 'haru_load_rw_custom_fields', 1 ); // Use this for back-end
    add_action( 'rwmb_meta_boxes', 'haru_load_rw_custom_fields', 1 ); // Use this for front-end @TODO: do not know now
    }

    then go to last line and change the code from:
    add_filter( 'rwmb_meta_boxes', 'haru_register_meta_boxes' ); // From version 4.8.0
    to:

    if ( current_user_can( 'manage_options' ) ) {
        add_filter( 'rwmb_meta_boxes', 'haru_register_meta_boxes' ); // From version 4.8.0
    }

    Hope this helps and thanks for reading!

     

    *****
    Best regards,

    HaruTheme

     

    • This topic was modified 4 months, 1 week ago by admin.
    • This topic was modified 4 months, 1 week ago by admin.
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.