Created
December 17, 2021 19:39
-
-
Save markbosky/f9f8aa67caea56603e6af7d91fb6590f to your computer and use it in GitHub Desktop.
WordPress - Remove AMP for WP – Accelerated Mobile Pages Post Meta Boxes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Hide Accelerated Mobile Pages Admin Menus | |
| function plt_hide_accelerated_mobile_pages_menus() { | |
| //Hide "AMP". | |
| remove_menu_page('amp_options'); | |
| //Hide "AMP → Setup". | |
| remove_submenu_page('amp_options', 'amp_options&tab=1'); | |
| //Hide "AMP → Settings". | |
| remove_submenu_page('amp_options', 'amp_options&tab=2'); | |
| //Hide "AMP → Design". | |
| remove_submenu_page('amp_options', 'amp_options&tab=19'); | |
| //Hide "AMP → Extensions". | |
| remove_submenu_page('amp_options', 'amp_options&tab=30'); | |
| //Hide "AMP → Upgrade to Pro". | |
| remove_submenu_page('amp_options', 'amp_options&tab=31'); | |
| //Hide "AMP → Documentation". | |
| remove_submenu_page('amp_options', 'amp_options&tab=32'); | |
| //Hide "AMP → Import / Export". | |
| remove_submenu_page('amp_options', 'amp_options&tab=33'); | |
| } | |
| add_action('admin_menu', 'plt_hide_accelerated_mobile_pages_menus', 11); | |
| // Hide Accelerated Mobile Pages Meta Boxes | |
| function plt_hide_accelerated_mobile_pages_metaboxes() { | |
| $screen = get_current_screen(); | |
| if ( !$screen ) { | |
| return; | |
| } | |
| //Hide the "Show AMP for Current Post?" meta box. | |
| remove_meta_box('ampforwp_title_meta', $screen->id, 'side'); | |
| //Hide the "AMP Page Builder" meta box. | |
| remove_meta_box('pagebilder_content', $screen->id, 'normal'); | |
| //Hide the "Custom AMP Editor" meta box. | |
| remove_meta_box('custom_content_editor', $screen->id, 'normal'); | |
| } | |
| add_action('add_meta_boxes', 'plt_hide_accelerated_mobile_pages_metaboxes', 20); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment