| Snippet Status | Done |
| Snippet Description | |
| Snippet Type Code | Other |
| Snippet URL | |
| Snippet Content | /**
* Allow unfiltered html for admins on multisite
*
* Opens up unfiltered_html capability for administrators on a multisite installation for placing html like embeds.
*
* @author Toine Branbergen * @version 1.2
* Created: AI (GPT-5 mini) and modified by Toine Branbergen
*/
add_filter('map_meta_cap', 'nrdq_allow_unfiltered_html_for_admins_on_multisite', 1, 4);
function nrdq_allow_unfiltered_html_for_admins_on_multisite($caps, $cap, $user_id, $args) {
if ($cap !== 'unfiltered_html') {
return $caps;
}
if (!is_multisite() || is_super_admin($user_id)) {
return $caps;
} $user = get_userdata($user_id);
if (!$user) {
return $caps;
}
$allowed_roles = array('administrator', 'shop_manager', 'employee'); if (array_intersect($user->roles, $allowed_roles)) {
return array('unfiltered_html');
} return $caps;
} |
| Snippet Content CSS | |
| Snippet Content HTML | |
| Snippet Content JS | |
| Snippet Content PHP | /**
* Allow unfiltered html for admins on multisite
*
* Opens up unfiltered_html capability for administrators on a multisite installation for placing html like embeds.
*
* @author Toine Branbergen * @version 1.2
* Created: AI (GPT-5 mini) and modified by Toine Branbergen
*/
add_filter('map_meta_cap', 'nrdq_allow_unfiltered_html_for_admins_on_multisite', 1, 4);
function nrdq_allow_unfiltered_html_for_admins_on_multisite($caps, $cap, $user_id, $args) {
if ($cap !== 'unfiltered_html') {
return $caps;
}
if (!is_multisite() || is_super_admin($user_id)) {
return $caps;
} $user = get_userdata($user_id);
if (!$user) {
return $caps;
}
$allowed_roles = array('administrator', 'shop_manager', 'employee'); if (array_intersect($user->roles, $allowed_roles)) {
return array('unfiltered_html');
} return $caps;
} |
| Particle Snippet in Software | 1 |
| Particle Snippet in Boilerplate | 0 |