Home › Forums › Themes Support › How to show Page Options with only Administrator
Tagged: page options, user roles
- This topic is empty.
-
AuthorPosts
-
September 17, 2021 at 2:37 pm #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:
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
-
AuthorPosts
You must be logged in to reply to this topic.