Can the wp-plugins (Must Use Plugins) URL be targeted for use in functions.php?

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’);

Warning/Notice about functions.php

‘;)’ => ‘icon_wink.gif’, is in line 2477 in the current version, you should never just change or delete core files, unless you know how to run a private branch of WordPress. Line 2925 is the second trigger_error() in this function: function _deprecated_argument( $function, $version, $message = null ) { do_action( ‘deprecated_argument_run’, $function, $message, $version ); … Read more

How to reduce original image quality on upload?

In general I wouldn’t recommend modifying the original uploaded image files, just in case we might need to re-generate intermediate sizes. But let’s see if it’s possible 🙂 We can in general let WordPress choose the image editor, that depends on modules like GD or Imagick, through: $editor = wp_get_image_editor( $file ); but this can … Read more

How can I remove the title “leave a reply” in the comment box in twentyeleven?

You can filter the default comment_form arguments (which is what’s causing the “leave a reply”). Just drop this in functions.php or in a plugin file. It would probably be better to put it in a plugin and keep your twenty eleven theme unedited (read: easily updated). <?php add_filter( ‘comment_form_defaults’, ‘wpse33039_form_defaults’ ); function wpse33039_form_defaults( $defaults ) … Read more

Apply jquery script to only woocommerce product pages and categories

There are two ways you could do that. 1. Using JS only WordPress themes normally use the body_class() function. As a result you’ll see that the <body> tag will have lots of classes. You can then target pages with a specific class to run your code in JavaScript: if( $(‘body.whateverclass’).length || $(‘body.anotherclass’).length ){ // Your … Read more

How to call WordPress functions from a form processing script

You should never post anything to plugins files directly. It’s almost always a security flaw and it prevents site owner from hardening the site properly (in perfect situation no requests to PHP files inside wp-content should be necessary at all) Good practice is that you use admin_post actions… (similar to admin_ajax). So your form should … Read more