How can I delete options with register_uninstall_hook?

You could always use an uninstall.php file for the plugin instead. http://codex.wordpress.org/Function_Reference/register_uninstall_hook If the plugin can not be written without running code within the plugin, then the plugin should create a file named ‘uninstall.php’ in the base plugin folder. This file will be called, if it exists, during the uninstall process bypassing the uninstall hook. … Read more

Jigoshop and WooCommerce differences

I won’t comment on all features, but I will say take a look through the changelogs for WooCommerce, our blog, and our public GitHub repository to get an idea of the features we’ve added, what we’re currently developing, and the over-all direction we’re taking with WooCommerce. A few of the features we’ve added to our … Read more

Custom Taxonomy in plugin and template

First of all – plugins are for generating content, themes are for displaying it. So really, a plugin shouldn’t do this. But there are grey areas – for example in an ‘events’ related plugin, it would be desirable to display dates, venue etc – things that a WordPress theme wouldn’t normally display. I would suggest … Read more

fatal error get_page_permastruct()

This happens because plugins_loaded fires before the global variable $wp_rewrite exists. From wp-settings.php: // Load active plugins. foreach ( wp_get_active_and_valid_plugins() as $plugin ) include_once( $plugin ); unset( $plugin ); // Load pluggable functions. require( ABSPATH . WPINC . ‘/pluggable.php’ ); require( ABSPATH . WPINC . ‘/pluggable-deprecated.php’ ); // Set internal encoding. wp_set_internal_encoding(); // Run wp_cache_postload() … Read more

Woocommerce – Hide “add to cart” on free products

Look at the beginning of the add to cart templates in WooCommerce. At the beginning there is a check to determine whether the product is purchasable. Inside the is_purchasable() method in the product class is a filter. By default the product is not purchasable if there is no price set at all, but that can … Read more

Should messages in WP_Error already be html escaped?

No, escaping should happen at the moment of output ( late escaping ) so that we know that it only occurs once. Double escaping can allow specially crafted output to break out. By escaping, we’re talking about functions such as esc_html, wp_kses_post, esc_url, etc. Sanitizing functions and validating functions are not the same, e.g. sanitize_textfield. … Read more

How to register_sidebar() without messing up the order?

function self_deprecating_sidebar_registration(){ register_sidebar( /* Your arguments here */ ); } add_action( ‘wp_loaded’, ‘self_deprecating_sidebar_registration’ ); Most themes will register the sidebar in their functions file, which is included before init but after plugins are loaded. Hooking onto wp_loaded should guarantee that your sidebar is registered after the theme’s.

Resizing all images

I asked a similar but broader question, and I still need to research and write a complete answer. In the meantime here are some pointers that might help you: I wrote a set of plugins that resizes all images to the size used in the editor. It works by converting <img src=”https://wordpress.stackexchange.com/questions/4984/image.jpg” width=”200″ height=”400″/> to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)