If you’ve already found an answer to this that works well for you, I encourage you to post it here for others to see. If not, the way I would go about it would be to use a custom filter or an action.
Where the menu is output in the theme, either use apply_filters
or do_action
to trigger the override you want, and in your plugin, hook into that action/filter to output the override. This is a more non-destructive way of accomplishing the same task, as you then don’t overwrite a menu association.
Related Posts:
- add_menu_page() with different name for first submenu item
- How to add sub-menu to a menu generated by wp_nav_menu by using plugin
- Change the_title() of a page dynamically
- How do I programatically insert a new menu item?
- Add Dividers or Separators Between Nav Menu Items
- Nav Menu meta failing to import
- Overwriting Core WordPress Functions with Plugins
- Some nav-menu filters do nothing
- Determine which theme location a wp_get_nav_menu_items is for
- Can I add pages to my custom menu via script?
- Replacing WordPress menu functionality with a plugin
- Hook event for upload image in the menu
- Why isn’t the Settings API designed to work for plugins using custom admin menus? [duplicate]
- How do I approach removing menu items on the fly based on settings in my plugin?
- What is the difference between current_page_parent and current_page_ancestor?
- Delete a specific item menu when I deactivate my plugin
- Create a Page via plugin
- Add Submenu Link in add_submenu_page That Opens in a New Window
- Header Button Chance Polylang Elementor
- PHP 7 – Class Method Compatibility Issue
- How to add pages to custom menus on the fly [duplicate]
- How do I add a custom sublevel menu specified in one directory to a custom top level menu specified in another directory?
- Add notification bubble notice in navigation using transients
- Get Current Menu Location inside Nav_Walker
- Adding custom fields to WordPress nav menus
- Sub Menu content is being duplicated
- Plugin menu addition in multisite
- Remove unwanted elements for a wp_nav_menu
- Is this best practice for Dynamically adding items to WordPress menus?
- How to remove or add submenu item on plugin activate or deactive
- Custom code for WordPress dynamic menu
- How do I access the menus produced by Dashboard > Appearance > Menus
- wordpress add_submenu_page adds broken link
- WP Enqueue style on all plug-in pages
- Add child pages to submenu automatically
- Customize existing menu item
- Menu page with minimum capability as ‘Subscriber’ doesn’t allow ‘Admin’ to access it?
- Issue with plugin sub menu and pages
- How to add Plugin functionality in WordPress Frontend Menus
- How to hide page links from theme menu
- WP_NAV_MENU filter targets all menus
- How do I add a menu item to a Pods admin menu?
- Add user managable titles to custom menus?
- How to create archive page to add in menu
- How to show only the last two categories in a menu?
- Always hide a page from the menu
- remove different admin menu for specific users
- How to get an array out of a nav menu if it’s a plugin?
- What happens when you create/edit a menu
- Plugin admin list pages as submenu
- Adding parent custom post type menu option
- Create and style menu
- Change the class of wordpress menu
- Invalid Menu Items
- Declaration of mandoe_menu_walker::start_el(&$output, $item, $depth, $args) must be compatible with Walker::start_el(…)
- Custom Nav Walker $item->url producing malformed hyperlinks
- Displaying an Uploaded Image as a Custom Avatar in WordPress
- Adding a navigation with wp_nav_menu() to a custom block in the site editor
- A tool to analyze rewrite rules? [closed]
- How can you check if you are in a particular page in the WP Admin section? For example how can I check if I am in the Users > Your Profile page?
- Settings API with arrays example
- ajaxurl not defined on front end
- How do you store options with a:n:{{}} syntax in wp_options?
- Send user activation email when programmatically creating user
- API to trigger prompt on leaving page
- Creating custom field with drop down on new post page
- Copy Tags from one post type to another post type
- How to Add Page Template from Plugin without Losing $this
- Extend plugin options page
- How to get the post content after WordPress post processing?
- Global State During an Admin Post
- Display custom fields in frontside user profile
- Strange issue saving custom field data for a WooCommerce order
- Is using custom table to suit business needs instead of transients a big hit to page load speed?
- Build a translation correcter plugin
- Selectively update themes in WordPress multisite
- How to create a page with a form programmatically in WP?
- jQuery instantly executes (a button click and css change) on load
- Meta box on options page save form problem
- How to make my shortcode load scripts and styles, from within the plugin?
- Class cannot be found, but it’s available in the file, I get: Fatal Error: Uncaught Error: Class ‘Blocks\Base\Activation’ not found
- how to change image of jquery slider plugin
- Sending an SMS on new order placed – WooCommerce
- Where to use nonce
- How to show parents of current page category, excluding the category?
- How to use a WP_Customize_Control outside of the Customizer?
- Overwriting a plugin function
- How do I debug an error that a plugin is causing?
- Update plugin settings option_name for big plugin update
- What could cause a WP Option to get truncated?
- Simulating timeout is not working
- Add custom product data using javascript when add to cart button is clicked
- How to develop a wordpress plugin for front-end user?
- Issue with iframe in TinyMCE
- save_post not called in plugin / custom field still saving overwriting metaboxes
- Loop output for custom plugin [solution found]
- How to Pass ID through Short Code
- Need edit profile link in the menu for logged in users
- PHPUnit Testing Installation Issue
- Problem with Owl Carousel, infinite loop [closed]