Non-Admin Accounts for Demo Purposes – (Pro Plugin Only)

Overview

All non-admin user accounts assigned to default WordPress user roles are not affected by demo admin account limitations, as the capabilities of those roles (Editor, Author, Contributor, and Subscriber) pose no security threat. Any content added or edited via demo user accounts is nothing to worry about. With automatic reset executions, the entire demo website will be restored to the chosen reset point. However, you may still want to restrict access to the following features on the WordPress user profile page.

Note: The WordPress ecosystem includes thousands of different plugins and themes. As a result, the features and functionalities you may need to block or restrict for various demo user account types can vary greatly. It is therefore not practically possible for us to provide guidance for every individual case. We strongly recommend that you adopt your own methods to restrict any specific features unique to your setup. This could include using a third-party restriction plugin, WordPress hooks, or custom PHP or CSS solutions. If you have developed effective methods, please do not hesitate to share them with us. (Email/Contact Form: Support) We will gladly publish this knowledge on our public forums to benefit the community. Thank you.

Hiding password, session management, and application password sections from the profile page

Copy and paste the below codes into your theme’s functions.php file or a custom plugin.

/**
 * Hides password, session management, and application password fields for all non-admin users.
 */
add_action('admin_head-profile.php', 'hide_account_management_fields');
add_action('admin_head-user-edit.php', 'hide_account_management_fields');

function hide_account_management_fields() {
    if (current_user_can('manage_options')) return;
    echo '<style>
		body.profile-php tr.user-pass1-wrap,
		body.profile-php tr.user-pass2-wrap,
		body.profile-php tr.user-sessions-wrap,
		body.profile-php #application-passwords-section,
		body.user-edit-php tr.user-pass1-wrap,
		body.user-edit-php tr.user-pass2-wrap,
		body.user-edit-php tr.user-sessions-wrap,
		body.user-edit-php #application-passwords-section {
			display: none !important;
		}

		/* Hide "Account Management" heading only on profile/edit screens */
		body.profile-php h2:has(+ table.form-table),
		body.user-edit-php h2:has(+ table.form-table) {
			display: none !important;
		}
	</style>';
}