EDIT: this solution is not a best-practice. Please use the solution submitted by Nathan below!
Use the WPMU_PLUGIN_DIR
and WPMU_PLUGIN_URL
constants 🙂
function load_my_alerts(){
wp_register_script(
'my_alerts',
WPMU_PLUGIN_URL . '/js/alerts.js',
array( 'jquery' )
);
wp_enqueue_script( 'my_alerts' );
}
add_action('admin_enqueue_scripts', 'load_my_alerts');
Related Posts:
- Remove Actions/Filters added via Anonymous Functions
- Programatically add options to “add new” custom field dropdown
- Excluding iPad from wp_is_mobile
- How to add classes to images based on their categories?
- How can I add an extra WooCommerce hook
- Wrap gutenberg block ‘div’ in other elements/extra HTML
- display public excerpt for private post
- automatically adding submenu items
- Functions.php: If its single?
- Remove Menu Page Giving Error
- How to add another user to this remove_menu function?
- Dequeue script in template isn’t working
- How do I call wp_mail from HTML?
- wp_link_pages: display current page number only if has multiple page breaks?
- RSS Feed has no styles in chrome – function to add one?
- Adjust which tempalte a page uses with a function?
- How to change menu icon which is overriden (i.e. by WooCommerce) [closed]
- WordPress Content Security Policy and Subresource Integrity
- Display trackbacks separately from comments in twentyeleven
- modify a function filter
- Accepted arguments value in hook functions
- Best practices for multiple Custom Feeds functions
- Print Post Parent Title
- Which action hook to use for function?
- How to automatically remove links from WordPress Biographical Info?
- Selective Product Category for Carousel
- How to change login labels
- Get the link for RSS item to display in feed
- Shortcode pagination not advancing
- Commenter should see only his comments in wordpress
- translate the_title() with .po & .mo
- Right way to update widget on dynamic new input field
- custom rss templete
- How can i disable auto save & revisions with `function.php` in wordpress?
- Move ‘current-menu-item’ class on #adminmenu li from Posts to Pages for Taxonomy Edit Screen
- Insert image in WordPress with HTML5 tag and caption function
- How to construct function for applying filter?
- WordPress on AWS Auto scaling and ELB giving 503
- WordPress PHP Conflicting User Sessions
- is_author(get_current_user_id()) returns false when author id and user id match
- How to use selected WordPress functions?
- Change slug shortlink “/?p=” base in WordPress
- Exclude category from shortcode
- unnecessary request call for js and css after calling wp_dequeue_script
- Custom HTML markup
- Functions Error: Impacting Galleries
- How to use author meta in shortcode?
- How to cut off question mark in url with functions.php
- Undefined variable error in new function
- How to rewrite wordpress search to work on specific category
- Theme JS is available but theme CSS isn’t
- Genesis Framework: How to exclude a specific author from archive custom loop
- How to Add Shortcode to html img code?
- Logout Redirect and also WP-login.php Redirect
- Proper Way to Load stylesheet on Condition
- Passing Jquery value to WordPress function
- How to pass variables from one function to another or combine functions
- How to create a shortcode out of a php function
- Is it possible to use add_filter in an included file in the child theme’s functions.php?
- Insert Content Before div#main from the functions.php File
- Insert function insde body tag
- Unable to add extra elements to the main navi (wp_nav_menu_items)
- Internet Explorer opens links to .msi files as text in a new tab
- call wp_insert_user in custom class doesnt work
- I would like single.php to act just like index.php
- Does WordPress has an automatic link parse function?
- A better way to get stats
- Conditional custom menu?
- What function actually renders the wp_admin_bar ? How can I call it?
- Get URLs for AJAX Filter Checkboxes WordPress
- redirecting a URL if accessed directly
- Detect Ajax call inside pre_get_posts function
- Render page with specific id from functions.php
- What is wp_get_post_tags for media tags?
- Filter works on last selection but no others
- How do I trigger WP CLI DB export using a PHP function?
- WordPress does not load jQuery
- get_current_user_id() always return 0 in if else statement
- Redirect specific author posts to another url
- Show number of sold products but be first for less than 2
- How to retrieve image IDs from shortcode content?
- 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)
- Class::$template_dir_path=get_template_directory();
- admin-ajax.php & my wp-admin folder url showing in header
- WordPress – Custom Nav menu for logged in users – Shopkeeper theme
- Change post count on tag/terms pages to 10
- How to use if (is_page_template (”))
- wordpress function through ajax not being called
- Error function main() is a non-object to construct my Ajax.php
- Automatically add custom fields (post_meta) to all published posts, hourly, via wp_cron?
- How to mirror exactly the left admin menu on front end?
- Gravity Forms After Submission – GFFormsModel::update_lead_field_value?
- Fatal error after changes to functions.php, even with original file
- update_post_meta after form is submited
- Make a table out of meta box
- Should I use `get_stylesheet_uri()` or `get_template_directory_uri()` when calling my CSS Stylesheet?
- Missing argument 2
- Customizer cuistom CSS Priority ordre Issue
- WPDB query suddenly not working