How to roll back a WordPress plugin update?

Unless the plugin has made significant database changes, you could follow these steps to downgrade it: Download and extract the old version from the plugin repository Disable the plugin Log on to your server with FTP or SSH Upload the old plugin directory to wp-content/plugins/. (You would want to overwrite the newer version.) Reactivate the … Read more

How do I cleanly override a plugin’s CSS with a child theme?

If the plugins are correctly adding their styles via wp_enqueue_style, you simply need to dequeue them: function wpa_dequeue_style() { wp_dequeue_style( ‘plugin-style-handle’ ); } add_action( ‘wp_enqueue_scripts’, ‘wpa_dequeue_style’, 100 ); Whether or not this works depends on how and where the plugins are adding their styles, so there’s no absolute answer without knowing specific methods the plugins … Read more

dbDelta only creates the last table

Run dbDelta for each SQL statement seperately: function myplugin_install(){ global $wpdb; $table_name = $wpdb->prefix . “vehicles”; require_once(ABSPATH . ‘wp-admin/includes/upgrade.php’); $sql = “CREATE TABLE IF NOT EXISTS $table_name ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, description VARCHAR(25) NOT NULL, PRIMARY KEY (id) ); “; dbDelta($sql); $sql2 = “CREATE TABLE IF NOT EXISTS $table_name1 ( … )”; … Read more

How to call a plugin function from index.php

The same way you would any other: foo(); Active plugins are loaded before the theme files You may want to check that your plugin is activated and the function is available so things dont go pear-shaped if you forget to activate it, like: if(function_exists(‘foo’)){ foo(); } else { echo “oh dear you haven’t activated/installed ‘myplugin’, … Read more

WordPress 3.5 Media Manager – add a button

This block of code will add a button right next to the “Insert into post” one. When clicked, it will send selected images to WP editor, each wrapped inside your template HTML: var wpMediaFramePost = wp.media.view.MediaFrame.Post; wp.media.view.MediaFrame.Post = wpMediaFramePost.extend( { mainInsertToolbar: function( view ) { “use strict”; wpMediaFramePost.prototype.mainInsertToolbar.call(this, view); var controller = this; this.selectionStatusToolbar( view … Read more