The preferred method of creating a settings page is to use the WordPress Settings API.
From your code example, it looks like it’s too late to remove the admin_notices
hook inside your callback in the admin_menu
hook.
You should try to move the logic from the customfunc()
callback into another callback activated from some earlier hook, for example admin_init
.
Additionally:
You are also calling the new admin menu page settings, but the user might confuse it with the existing Settings page.
The User Levels you have in one of the add_menu_page()
input parameters, are deprecated, use instead some of the Capabilites mentioned here.
So instead use for example:
add_menu_page( 'My settings', 'My settings', 'manage_options', 'custom', 'customfunc' );
Related Posts:
- How can I see all the actions attached to an “add_action” hook?
- Which hook callback has priority if both plugin and theme use the same hook?
- How to Use Parameters with a Do_Action Function Within PHP Tags
- How to stop or remove an action being called inside a function of an extended class
- Automatically add attributes to woocommerce product?
- wordpress plugin is not activating from widget
- Removing an action from wp_footer called in a class that’s inside a bigger class
- What is @Action in WordPress?
- How passing values to construct function with Actions?
- Basic function call on init failing
- Are there action hooks for comments?
- Hooking into the HTML header container
- Get post content inside plugin class method
- Ajax call to php function doesn’t work PHP code
- Creating Admin Submenu Page via Class Method
- plugins_loaded action is not working properly
- Plugin Hook: Get posts
- When unit testing a plugin, does the plugin need to be in the wp-content/plugins directory of the WordPress tests install?
- How can I prevent a plugin from updating unless it’s minimum PHP version is met?
- What is the ‘admin_action_’ . $_REQUEST[‘action’] hook used for?
- Determining where fopen() is writing files when used from WordPress AJAX call [closed]
- How Restrict access to admin dashboard by specific static ip?
- Overide a function that is inside a plugin
- How to get images from EDD post?
- Add multiple attributes to product from php
- How to install and activate a plugin via an external PHP script
- How to remove xmlns on language_attributes()?
- How to initialize something in unit test before the init hook being called?
- Add category to body class
- Plugin Development sqlite or WordPress’ database
- How to review WordPress website php version compatibility?
- Add keywords meta to index.php page
- Download any file after submitting a form [closed]
- Pulling data from custom plugin settings using PHP shortcode and Javascript
- woocommerce 3.2.1 not sending order notification emails
- Redirecting a buddyboss profile tab to a different tab if not subscribed to a specific membership
- Add a CSS class based on categroy id to archive pages
- Access WordPress data from external PHP application.
- Problem with PHP wordpress, Undefined index: in C:\xampp\htdocs\wordpress\wp-content\plugins\epoch\classes\core.php on line 190 [closed]
- WordPress user account activation
- How to create a custom post type that contains another custom post type?
- WP Query. Is there a maximum size?
- WP Plugins – Use includes to display page content
- Add action to fire when a published post is updated
- Using add_action before add_filter on a plugin?
- WordPress custom taxonomy not showing
- My WordPress site when down after installing a plugin and now all I get is a simple white screen [closed]
- execute function after one completed
- WHy custom plugin slows down the loading of the pages?
- Adding media upload button to User Profile page (following a tutorial)
- Pass user role to javascript code inside body
- Integrating boxtal PHP library into a custom WordPress Plugin
- WordPress Stock Update Programatically
- UTF-32be error WordPress
- Getting a ressource ID, from a WC_Order_Item_Product/Order
- Customize Menu | Styling LESS/SCSS code formats
- same user role or copy the user role to be same as the other role
- Social share buttons text shows up on post excerpts
- How to use add_action for multiple instances of the same class
- Edit post image attributes on fly?
- How to displaying Custom image, text and default image logo from Redux Framework option panel
- Plugin Admin panel checkbox unchecked after submit
- Getting URL GET parameter with Code snippets and storing it in database?
- Send Array from JS to php file then insert it in wp database through a plugin
- Offer Download Links for Product Images
- save_post_product action not firing
- How to get the custom field value using SQL query
- WordPress fatal error from php protocol codes
- Possible way of having multiple Gutenberg instances for a page?
- Woocommerce add products to cart
- Why do actions with class and public method don’t fire __construct()
- Changing wordpress/woocommerce notices default message to other languages (text)
- Why does my custom plugin only function correctly once per page?
- Using id to show item
- I can’t view the orders on the woocomerce dashboard with the brainblocks plugin
- Run a Change Role Cron Job on WordPress via cPanel
- How to display variables from plugin?
- How to make the first letter of a post title uppercase, in a plugin?
- How to echo meta_key in easy digital downloads receipt (Purchase Confirmation page)
- Plugin error “array_key_exists(): The first argument should be either a string or an integer” [closed]
- How to change the product short description for each product with PHP?
- Help needed with woocommerce (wc stripe) filter
- I want add repository theme folder
- Migrating custom php we wrote from functions.php into a site-specific plugin
- What is the correct entry point for capturing coverage data
- ACF Repeater Field Question [closed]
- Creating a user ‘add custom field’ section
- How do I convince this button to do something when it is clicked?
- add_media_page function not creating submenu
- WordPress function to add text
- TheCartPress plugin – Make every item in store unique
- Doing action based on input from options menu
- Insert dynamic content into posts
- avatar displays outside of targeted area
- How wordpress plugin hooks works? [duplicate]
- My wordpress site wont load, it gives header error warnings
- Can anyone see a syntax error in this? [closed]
- Function not being called on form submit, only blank admin-post.php page
- cURL External API request displays content above other content on page
- WordPress Convert queries to slashes using function.php