The Core menu system, which was not mentioned in the initial version of the question, does not have any “before” and “after” hooks that I can find. You could create a custom Walker that could include those hooks but it is going to be a theme problem, either way.
If that is not satisfactory, you will need to alter the DOM with Javascript. I don’t know if that is even possible/viable for the code you want to include but if that is an option you need to hook code to wp_enqueue_scripts something like this: https://wordpress.stackexchange.com/a/128250/21376.
You can use wp_localize_script() to write data to the page that your script can use. For example: https://wordpress.stackexchange.com/a/92184/21376.
Related Posts:
- Notify comment author upon reply
- WordPress get_avatar function not correct working
- Make change in media library affect images in published articles
- Should I not update the plugin?
- Improving the perfomance of a plugin action
- How to add Wrapper Div/container element around WordPress Widget Content
- Can I use Symfony components in a plugin that I want to submit to the WordPress plugin repository?
- UpdraftPlus installed malware – scared to download or update plugins now! [closed]
- Duplicate New User Registration notices (BuddyPress and bbPress both installed)
- How to show the number of website visitors in my theme
- Is there any plugin which enables users to rate comments in thumbs up-down way?
- Plugin Repostitory Questions
- Free paypal cart solution [closed]
- Get site url and updates data, then use them
- How to integrate together a website currently hosted WordPress.com and a custom web application currently hosted on Azure?
- Problem with add_action
- How to update a local development plugin on a separate machine
- Error When Trying To Login [closed]
- unable to remove malware from wp website [closed]
- How do I convert my WordPress website to be domain agnostic?
- Get Image Having the ID [closed]
- Show media-uploads to all users
- How to create plugin auto create page wordpress?
- Scrape a webpage for image and add it to post
- Block wordpress style for my plugin admin page
- I want to reset user’s post meta after successfully login
- how can authors to define custom pages?
- Widget Screen Locked
- Send a Notification to a WordPress Theme
- Gathering all Custom Post Type posts in to array/object the proper way
- How to prevent plugin, theme installation failures on WordPress?
- How to make a slider hearder?
- Warning: Attempt to read property “ID” on null in C:\xampp\htdocs\Nnamdi1\wp-content\plugins\elementor\core\base\document.php on line 250 [closed]
- Adding CASE in WP_Query
- why I cannot activate elementor plug in?
- How to find the following specific WordPress variables?
- Need help creating asynchronous data scraper in WordPress
- Load extra post content from plugin, after load basic post content
- i need to make custom cron_schedule with custom interval time as a parameter into a custom payment gateway plugin wordpress
- Trying to get property ‘ID’ of non-object in /wp-includes/class-wp-query.php on line 4044
- How to upload large media file in chunks, without any plugin?
- Redirect unloggedin users
- WP Function does not trigger on Webhook API Call
- WordPress asks to update a plugin already updated
- Why do I need to reload the page for WordPress to see the new custom field added with jQuery
- How to store a secret for a plugin inside public_html
- Do images in plugins automatically load?
- How to use functions found inside pluggable.php with my plugin files
- Apply only the css in my style.css file
- WordPress:Custom banner from psd trying to cut out a button area so the website link can be clicable not working
- Global $wp_admin_bar always returns null
- Edit plugin’s HTML output with Hooks
- How to echo a PHP Code After the Content
- Shortcode generated widget to appear on same line as heading text and button
- WooCommerce or any other plugin: Deliver JS and CSS through CDN without using a Plugin
- How to roll back WordPress version or prevent migration from forcing update?
- How to find out programmatically whether any cache plugin is installed in the WordPress website?
- Show custom taxonomy in theme
- errno: 150 “Foreign key constraint is incorrectly formed” [closed]
- Implementation to count page visits of unique visitors based on a cookie
- How to prevent encoding plugin HTML output to entities?
- How to differently style pages that display posts of different category in WordPress?
- WordPress FTP/media directory permissions problem?
- Social sharing plugin directing to blank page after post sharing
- accessibility of an object created in a plugin, from the header
- How to build a navigation menu for long-form texts like this one
- MobilePress plugin and WordPress 4.1 update
- Theme styling for plugins
- Like/Dislike Bar not working when updating
- how to change/remove/hide menu under installed plugins
- Get Core Functionality from Within a (Secondary) Plugin File
- Simple fields plugin WordPress show repeatable file field
- How to check my WordPress.org site MySQL queries generating items?
- No feedback when installing plugins or updating
- WordPress plugin add_filter returning a link does not work. What is the correct way?
- Screen Options drop-down does not show
- onclick open window [closed]
- how to make a plugin secure, so any one if changes something in plugin, it just disables it self and notify us on server? [closed]
- WooCommerce – Adding notice above products on Shop Home [closed]
- How to create separate shop pages in woocommerce for each product category [closed]
- WooCommerce Cart not showing up [closed]
- $wpdb selects wrong database
- Plugin update warning
- JQuery UI plugin not working in IE7?
- Possible to change meta data single quotes to dobule quotes in yoast wordpress seo? [closed]
- how to know that a wordpress plugin support using API?
- Activate plugin button do nothing [closed]
- WP asking for ftp credentials when deleting plugin
- How can I view the responses of contact forms on different sites in one panel or elsewhere? [duplicate]
- Page with redirect
- How to add a simple design in classic editor plugin creating post page through another Wp plugin
- How to fix Fatal error: Cannot redeclare get_cli_args() in class-wp-importer.php
- Is there any performance difference between duplicating composer packages among multiple plugins and not doing it? How can I avoid it?
- Why is my Gutenberg block not saving and rendering the chessboard?
- Is it possible to use Classes between WordPress plugins with separate namespaces?
- Function to consider a plugin activated for selected users only
- unlimited chat rooms/channels/groups
- refresh media library item
- Similar hook to ‘init’ for when plugin page loads
- Elementor wp_register_script showing file when i not use ‘wp_enqueue_script’