Try this instead:
function remove_posts_menu() {
if ( ! current_user_can( 'manage_options' ) )
remove_submenu_page( 'jetpack', 'jetpack' );
}
add_action( 'admin_init', 'remove_posts_menu' );
where the menu slug and submenu slug are jetpack
.
Related Posts:
- Adding fields to the “Add New User” screen in the dashboard
- Displaying the number of updates available in the Admin area
- What’s the difference between admin_url() and get_admin_url() functions?
- How to influence the information displayed on widget inside wp-admin
- How to override admin-bar style
- TinyMCE custom styles remove class when switching styles
- How do I create a new WP admin color scheme?
- AJAX handler throws 400 (Bad request) – why?
- wp-admin page is blank
- Replacing select2 in admin backend for all selects
- difference between add_object_page and add_menu_page
- How to fix a theme with page.php Default Template that accidentally deleted?
- Target a certain page within wordpress backend (admin) i.e. Pages > About
- How can I rename the WordPress AJAX URL? [duplicate]
- Allow latex in wordpress excerpt
- How to add a column to the Trash page?
- Comments to only be seen by their author
- How to change menu icon which is overriden (i.e. by WooCommerce) [closed]
- Custom roles can’t access to wp-admin
- password protected post policy
- Access / Filter block variations in Gutenberg, in WordPress 5.6
- How to remove howdy dropdown menu content
- Add Featured image column into wordpress admin on pages AND posts
- Selective Product Category for Carousel
- How to force field validation first, then its values saved durning edit profile?
- Move ‘current-menu-item’ class on #adminmenu li from Posts to Pages for Taxonomy Edit Screen
- How to auto refresh when user change postcode
- Sections and tabs DRY – WordPress settings API
- How to install Segment on WordPress without a plugin
- Get First Child Page ID or Permalink in WordPress Admin
- Creating A New Admin Menu Tab For Theme Options
- wp-admin won’t load after setting wp-login custom url
- Wp admin – Set default value to 999 in comments
- Remove “Published On” inside wp-admin
- Where do i create my own function in wp-admin
- How to remove comment count column in Posts inside the admin dashboard?
- What is the text that appears beside the page titles in the list of pages in the WP admin?
- Sortable column (by numbers) in admin users
- Remove Jetpack infinite-wrap
- error at login page in wordpress
- Update to functions.php not showing in dashboard
- Add element to widgetpage
- Best way to disable sidebars on posts (only)?
- “options.php” not found
- How to change a specific admin label
- How to change a meta value (of a published post) after X days.?
- Block all plug-ins from initiating redirection upon activation?
- How to add custom metakey to shop_order page’s searching function?
- Unable to login after registration
- Insert Modal on user first login
- WP Enqueue Script Error
- DISABLE wordpress upgrade page
- admin-ajax.php & my wp-admin folder url showing in header
- What is wrong with functions.php? Fills error log with same error
- How to add next height number in Order Attributes inside the Add new page. [duplicate]
- Changed functions.php file and now site is blank [closed]
- Setcookie not setting cookies anywhere except admin
- Excluding iPad from wp_is_mobile
- How can I get $id variable in widget’s form function?
- How to hook into the quick edit action?
- Make WordPress size and name images for Retina.js
- How to programmatically set a menu to be the Primary Menu?
- Pinterest Integration Using functions.php
- Trying to inject twitter metadata into using wp_head action in functions.php – get_the_excerpt() returns null
- Get current page_id before loop, in functions.php
- Menu fallback “menu_class” rendering a “div” instead of a “ul”
- Which action hook to use for function?
- Change size and crop medium_large images
- Right way to update widget on dynamic new input field
- Remove elementor header and display default theme header
- enqueue styles for only mobile wp
- WordPress PHP Conflicting User Sessions
- Registration Hooks don’t appear to be working
- How to use selected WordPress functions?
- Change slug shortlink “/?p=” base in WordPress
- New functions in separate directory — better, portable way
- Logout Redirect and also WP-login.php Redirect
- Proper Way to Load stylesheet on Condition
- How do I place a function in a standalone page?
- Problem in using Customizer
- Do I Need to Prefix Variables Inside Functions?
- Render page with specific id from functions.php
- Display Child Pages if no child Exists Display Siblings
- How to show ACF value under post/page title in wp-admin
- Filter works on last selection but no others
- get_current_user_id() always return 0 in if else statement
- How do i tweak my wp Post title base on category of the post
- Why isn’t comment validation working?
- I’m creating a online store for my website, my aim is to add description to products in home page only how can i achieve it?
- Menu and category highlighting for a single post
- I need to ‘wp_dequeue_script’ and ‘styles’ and ADD a bunch of other css and js
- True email confirmation for registration (keeping unvalidated users from user table)
- Code I am placing in the wp_footer is going outside the entire HTML frame!
- wordpress function through ajax not being called
- How to assign results to variables?
- Hide certain post types from editors
- How to mirror exactly the left admin menu on front end?
- Make a table out of meta box
- is_user_logged_in() isn’t working
- WooCommerce, change “Add to Cart” to “Link to Product”, only for specific categories