Skip to content

Instantly share code, notes, and snippets.

@sybrew
Created June 1, 2023 13:57
Show Gist options
  • Save sybrew/69eea715fd1f59896f4df7f6b1c89565 to your computer and use it in GitHub Desktop.
Save sybrew/69eea715fd1f59896f4df7f6b1c89565 to your computer and use it in GitHub Desktop.
Hides TSF's admin interface from everyone but the Super Administrator (capability manage_network, or manage_options on non-multisite).
<?php
/**
* Plugin Name: TSF Headless Mode for non-super-admin.
* Plugin URI: https://theseoframework.com/
* Description: Enables Headless Mode for The SEO Framework in the admin area for non-admins.
* Version: 1.0.0
* Author: Sybre Waaijer
* Author URI: https://theseoframework.com/
* License: GPLv3
*/
add_action(
'plugins_loaded',
function() {
// If on the admin area, and if the user isn't a super admin, hide all SEO settings and prevent overwriting settings:
if ( is_admin() && ! is_super_admin() )
define( 'THE_SEO_FRAMEWORK_HEADLESS', true );
},
4
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment