Hide menu item based on user’s custom capability

This plugin provides filter to manage the menu item by meta value: function custom_menu_item_visibility( $visible, $item ){ if( isset( $item->roles ) ){ $user_id = get_current_user_id(); $user_meta = get_user_meta( $user_id, ‘your-meta-key’, true ); if ( /* your condition */ ){ $visible = true; } else { $visible = false; } } return $visible; } add_filter( ‘nav_menu_roles_item_visibility’, … Read more

Uncheck the box “Send User Notification” by default on new-user.php

There does not seem to be an easy overwrite without replicating the whole user interface. So the quickest solution might be to un-check the checkbox via JavaScript: add_action(‘admin_footer’, ‘uncheck_send_user_notification’); function uncheck_send_user_notification() { $currentScreen = get_current_screen(); if (‘user’ === $currentScreen->id) { echo ‘<script type=”text/javascript”>document.getElementById(“send_user_notification”).checked = false;</script>’; } } The script is only injected on the user-new.php … Read more

Update user meta through a front end form

There are 3 main issues in your code: I see you’re using current_user_id() which does not exist in WordPress, so I believe that should be get_current_user_id(). Your update_basic_user_meta() function basically would work in updating the user’s metadata, but you need to check whether the POST data (gender and specialty) are actually set before proceeding to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)