WordPress.org

Ready to get started?Download WordPress

Forums

Plugin menu page manage user roles (1 post)

  1. mvanboordt
    Member
    Posted 1 year ago #

    Hi,

    I'm building a page in the admin menu.
    Like a plugin.
    I want this page available for everybody regardless of the role the user has.
    How can I do this?

    I create the page by doing this:

    <?php
    add_action( 'admin_menu', 'my_own_menu' );
    
    function my_own_menu() {
    	add_menu_page( 'my_own_menu', 'my_own_menu', 'manage_options', 'my_own_menu', 'my_own_options', $icon_url, $position );
    }
    
    function my_own_options() {
    	if ( !current_user_can( 'manage_options' ) )  {
    		wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
    	}
    	echo '<div class="wrap">';
    	echo '<p>Let\'s Build</p>';
    	echo '</div>';
    }
    ?>

    I've tried different approaches but nothing seems to work.

Topic Closed

This topic has been closed to new replies.

About this Topic