Clean-up script tags

If you really want to do this, then it should already be possible. The global $wp_scripts is an instance of the WP_Scripts class, which is an instance of the WP_Dependencies class. So in theory (not tested), you should be able to do something like this: function alter_script_tags() { echo ‘<pre>’; print $GLOBALS[‘wp_scripts’]->print_html; echo ‘</pre>’; } … Read more

Changing post category from dropdown

Your form is using ‘get’ ( $_GET ), but addcat.php is looking for $_POST values. That is never going to work. But beyond that, you’ve got a pretty convoluted thing going on here. You don’t really both the hooked function and addcat.php. You need one or the other, and the hooked function is probably the … Read more

Actions according to image type and size

That function looks like the kind of thing that would slow down a site. 🙂 The first thing I’d recommend is that you not run that function on the front end. Run it when the image is uploaded and store the result in the database using wp_update_attachment_metadata. You can then retrieve the data with wp_get_attachment_metadata. … Read more

I would like to use create a function in my custom plugin to tell WP to use a different header

I am not sure what you want to do is doable (seems impossible to me but everything seems impossible until someone does it). I thought of a very ugly workaround. add_filter( ‘template_include’, function( $template ) { $temp = get_temp_dir() . basename( $template ); file_put_contents( $temp, str_replace( ‘get_header(‘, ‘get_header2(‘, file_get_contents( $template ) ) ); return $temp; … Read more