To do so, you will want to use the explode() function to break up each new line (\n) into another array value. Also it is important to replace the invisible Carriage Return which is also used as a new line character by Mac OS:
# Get the plugin options
$settings = get_option( 'myplugin_menu' );
if ( isset( $settings['main_menu'] ) ) {
# Convert each new line in the textarea as an array item
$menu_slug = explode( "\n", str_replace( "\r", "", $settings['main_menu'] ) );
foreach ( $menu_slug as $key => $value ) {
# Remove each menu item
remove_menu_page( $value );
}
}
Related Posts:
- Passing arguments to a admin menu page callback?
- Admin settings update updating every time home page is hit?
- What’s the best method for emptying an option created with the Settings API?
- What is the recommended way to create plugin administration forms?
- How to add a new plugin page under desired Options page?
- Is it possible to add an admin page using add_submenu_page() and pass a var in the query string?
- Overwriting Core WordPress Functions with Plugins
- Formatting of curly brackets array from WP database to get more readable output
- Naming Admin Menus and Submenus
- Current class on admin menu using add_submenu_page()
- Add Admin Menu Inside Construct or Init
- Multiple entries in get_option results? or why is _multiwidget set to 1?
- Hook event for upload image in the menu
- Menu Error in Admin Console with Custom Plugin: You do not have sufficient permissions to access this page
- add_menu_page() with function inside a class [duplicate]
- How to add Font Awesome 5 icons in WP Admin dashboard menu?
- How to put placeholder text in the main post input area?
- Unified Approach for Placing Option Pages
- array_map() for sanitizing $_POST
- Plugin with specific admin menu icon
- Passing array of strings to a SQL statement in a WordPress plugin
- OOP Plugin and Menu – Call to undefined function register_setting()
- Global State During an Admin Post
- Howto: Use Custom Post Types as Submenu Items in Admin
- Sub Menu content is being duplicated
- Set different custom menu items for different user roles
- Show/Hide ‘add new user’ custom fields in wordpress admin panel by click another field
- Bootstrap doesn’t work on admin menu page-How to override wp-admin style?
- is it recommended to use WP_List_Table?
- Plugin sub-menu pages recommended structure and links
- Creating Admin Plugin – Content of a page is displayed at global scope as well
- Add a page in admin without adding menu item
- Plugin Options Array Set to Undefined
- Silently register plugin pages
- WordPress theme options Menu
- Print Dashboard submenu name and filename
- I am trying to make a page in the admin section similar to the appearance of the Profile page for users
- Unable to get a simple plugin admin page to work
- Working of foreach loop with array
- Disable Auto-Expanding Menu in WordPress Admin Menus
- in_array function Problem
- Use options to control jQuery plugin
- Restrict certain actions to plugin-specific admin menu pages only
- Proper way to create an administration page without adding it to the menu
- Pause plugin option page until all data manipulation is complete
- How to add text editor in plugin menu?
- Decontruct serialized data array from wp_options
- How to make an admin plugin menu page go full screen?
- How to get the `comment_post_ID`?
- How to add admin.php to WP Admin Menu Link
- How put the correct URL to sub-menu plugin?
- Developing a plugin where users can edit entries saved in database
- Add a description/hint field in the admin page of a plugin
- When using an options array the Settings API isn’t creating the database record
- Forcing ALL plugin Admin menus into a separate menu
- Link to a admin submenu item using a custom link
- Plugin admin list pages as submenu
- Change Admin menu placement using hooks
- Menu_slug used for creating options page
- How to design WooCommerce-like admin tabs for plugin settings page?
- Show Admin Menu
- Is there a way to use MySQL JSON functions in meta queries?
- adding an options menu that allows saving multiple sets of said options
- How do I add CSS options to my plugin without using inline styles?
- How to override existing plugin action with new action
- Add custom TinyMCE 4 Button, Usable since WordPress 3.9-beta1
- How to store username and password to API in wordpress option DB?
- How do I create links at the top of WP_List_table?
- Why Does get_posts() Return an Empty Set?
- Where to enqueue stylesheets for plugin?
- How can the tinyMCE dom be manipulated (offical API does not seem to work)?
- stray elements
- Deletion of shared options using uninstall.php
- Plugin Settings not Saving on Ajax re-ordered table
- Undefined function wp_set_password
- WordPress password reset – why post rp_key?
- How to modify the new WordPress 4.5 link inline toolbar
- Proper way to hook wp_get_attachment_url
- How to install WordPress Popular Posts plugin twice?
- Get the link text
- Multisite plugin development and wp_enqueue_script
- Prevent plugin from deleting important directories
- Is Dreamweaver CS5 a serious choice for theme/plugin development?
- What allows a template file from plugin to be copied in child theme and overridden?
- How to set “Site Address (URL)” programmatically on WP multisite?
- creating custom archive template within plugin for custom post type using archive_template filter
- Reset plugins version cache | pre_set_site_transient_update_plugins
- Add column and post filter for a custom post type field on the edit.php page
- How to fetch all images from a WordPress draft using PHP?
- Can’t get woocommerce_get_price_html to work [closed]
- jQuery selectors for editor elements safe to use?
- parse content from wikipedia article replacing search term with the title of article
- Fatal error: Uncaught Error: Call to undefined function get_option()
- Strange Situation When Try To Retrieve Github Gist Using wp_remote_get
- Call API on post save/update and show the result in admin area
- Is there any other ways to replicating changes on live from staging without pushing from git
- upload image to wordpress media library failed for custom post type
- WordPress integration with GitHub without cmd line access nor local development?
- Problem with inline style CSS properties issue on DIV
- Custom database table entry edit page