Skip to content

Commit

Permalink
Added admin check for menu item
Browse files Browse the repository at this point in the history
  • Loading branch information
sushmak02 committed Jan 3, 2024
1 parent f9fe1a4 commit 73f8c1c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion admin/class-hfe-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ public static function hfe_admin_enqueue_scripts( $hook ) {
*/
private function __construct() {
add_action( 'init', [ $this, 'header_footer_posttype' ] );
add_action( 'admin_menu', [ $this, 'register_admin_menu' ], 50 );
if ( is_admin() && current_user_can( 'manage_options' ) ) {
add_action( 'admin_menu', [ $this, 'register_admin_menu' ], 50 );
}
add_action( 'add_meta_boxes', [ $this, 'ehf_register_metabox' ] );
add_action( 'save_post', [ $this, 'ehf_save_meta' ] );
add_action( 'admin_notices', [ $this, 'location_notice' ] );
Expand Down
4 changes: 3 additions & 1 deletion inc/class-hfe-settings-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ class HFE_Settings_Page {
*/
public function __construct() {
add_action( 'admin_head', [ $this, 'hfe_global_css' ] );
add_action( 'admin_menu', [ $this, 'hfe_register_settings_page' ] );
if ( is_admin() && current_user_can( 'manage_options' ) ) {
add_action( 'admin_menu', [ $this, 'hfe_register_settings_page' ] );
}
add_action( 'admin_init', [ $this, 'hfe_admin_init' ] );
add_filter( 'views_edit-elementor-hf', [ $this, 'hfe_settings' ], 10, 1 );
add_filter( 'admin_footer_text', [ $this, 'admin_footer_text' ] );
Expand Down

0 comments on commit 73f8c1c

Please sign in to comment.