Skip to content

Unable to view Dashboard and Settings #22330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 tasks done
awakash opened this issue Jun 4, 2025 · 0 comments
Open
2 tasks done

Unable to view Dashboard and Settings #22330

awakash opened this issue Jun 4, 2025 · 0 comments

Comments

@awakash
Copy link

awakash commented Jun 4, 2025

  • I've read and understood the contribution guidelines.
  • I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened

Unable to view Dashboard and Settings as it's not available as an option in the admin.

To Reproduce

Step-by-step reproduction instructions

  1. Custom role called 'technical_adminstrator' (not default adminstrator wp role)
  2. Only seeing Workouts and Redirects in admin

Expected results

  1. Should be seeing Dashboard, Settings, etc.

Technical info

Tried to add this action but still seeing Sorry, you are not allowed to access this page. in wp-admin/admin.php?page=wpseo_dashboard

function my_custom_capabilities() {
    // Get current user
    $current_user = wp_get_current_user();

	if ( $current_user->roles[0] == 'technical_administrator') {
		// Get current page
		global $pagenow;

		// Check if we're on a specific plugin's options page and if the user is the one specified
		if ( $pagenow == 'admin.php' && isset($_GET['page']) && $_GET['page'] == 'wpseo_dashboard' ) {
			// Temporarily add the 'wpseo_manage_options' capability to the user
			$current_user->add_cap('wpseo_manage_options');
		}
	}
}
add_action('admin_init', 'my_custom_capabilities');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant