Tag Info

New answers tagged

1

Hmm, missed this codex page... To solve this the number should be passed as a decimal as a string rather than an int; 20 -> '19.1' adjusted code; add_menu_page( 'Settings', 'Settings', 'manage_options', 'plugin_name', 'plugin_name_options_page', content_url( '/img/icon.png', __FILE__), '19.1' );


0

You need to find the right $menu_slug. The following code worked for me: add_action( 'admin_init', 'remove_menus' ); function remove_menus(){ remove_menu_page( 'wpcf7' ); }


0

I have used add_menu_page function to achieve the solution add_action( 'admin_menu', 'register_my_custom_menu_page' ); function register_my_custom_menu_page() { add_menu_page( 'camp', 'Camp', 'edit_pages', 'post.php?post=128&action=edit', '', 'dashicons-admin-home', 11 ); } ...


0

I think Михаил Семёнов is right, but I had to get another push by cybmeta in another thread, which lead to this: functions.php: $menu_alterations = array( 'user' => array('my-userA', 'my-userB'), 'items' => array('plugins.php', 'options-general.php'), 'action' => false, ); include get_template_directory() . ...


1

It's becouse you'r calling alter_item function outside action admin_menu here's working example i just made, try to figure what's wrong with your's by your self, if you fail i'll explain add_action( 'admin_menu', 'alter_items' ); function alter_items() { global $current_user, $menu; get_currentuserinfo(); $scopes = apply_filters( 'alter_items', ...


0

To execute a task after a option has been updated, you can use updated_option action hook: add_action( 'updated_option', 'updated_option_callback', 10, 3 ); function updated_option_callback( $option, $old_value, $value ) { //Do something } Also, you can use update_option_{option-name} specifically for each option. For example: add_action( ...


0

add_action( 'admin_menu', 'add_my_admin_menus' ); function add_my_admin_menus() { $GLOBALS['my_page'] = add_menu_page( 'Page Title', 'Menu Title', MY_ADMIN_CAPABILITY, 'menu-slug', 'show_page_content'); add_action( 'admin_enqueue_scripts', 'enqueue_admin_js'); } function enqueue_admin_js($hook) { if($GLOBALS['my_page'] === $hook) { ...


0

Working code for adding widget to wp dashboard with information from custom DB: /** * Add application widget to the dashboard. */ function addApplicationWidget() { wp_add_dashboard_widget( 'submitted_applications', 'Submitted Applications', 'showApplicants' ); } add_action( ...


0

You can use User Admin Simplifier plugin. It allows you to hide plugins and options from choosen users.


1

According to the documentation for add_menu_page: Note: If you're running into the "You do not have sufficient permissions to access this page" error, then you've hooked too early. The hook you should use is admin_menu. This means you need to wrap your menu creation in something like: add_action( 'admin_menu', function() { add_menu_page( ...


0

If I understand your question correctly, you are just looking for a way to include PHP files in other PHP files. There are a couple different ways, like include or require (as well as include_once and require_once, although it sounds like you'll be referencing the same file more than once possibly), both of which basically just bring an external php file in ...


0

use remove_submenu_page() like this : add_action('admin_menu','your_add_menu_function'); function your_add_menu_function() { add_menu_page('Menu Page Title','Menu Name','edit_theme_options/others caps...','parent_menu_slug',...); add_submenu_page('parent_menu_slug','Menu Page Title','Menu Name','...caps...','sub_menu_slug',...); ...



Top 50 recent answers are included