Hooking a function onto the sidebar?

Load at the sidebar bottom In most of the sidebars, you’ll find the call to the wp_meta() action hook, where you can hook into the (mostly bottom) of a sidebar. Load on top of your sidebar The function get_sidebar( $name ) calls the sidebar you want in your template (this allows to have different sidebars). … Read more

How to hook into unregistering a widget instance?

Yes, this can be done. Ultimately, adding and removing a widget to/from a sidebar means updating an option in the database with a call like this: update_option( ‘sidebars_widgets’, array( … ) ) If you look at the code of update_option you see that there is a filter called just before the actual update. So if … Read more

The hook for the AJAX Add to Cart button?

Digging through the code, it’s pretty straight-forward to find. First, look at the template used for product archives – /templates/archive-product.php. Among other things, it sets up the regular queries and begins building the markup of the page. But when it actually starts looping through each product, it delegates the work to /templates/loop-shop.php. This template is … Read more

Is there a WordPress core & plugins update action hook?

Hooks The hooks you’re searching for are ‘pre_set_site_transient_update_plugins’ and ‘upgrader_post_install’ The later takes three arguments. Example: function upgrader_post_install_cb( $true, $hook_extra, $result ) and should be used for: Move & activate the plugin, echo the update message. Moving plugins Moving works like this: $wp_filesystem->move( $result[‘destination’] ,’your_destination_path’ ); Then use activate_plugin( ‘path/file’ ); after moving.

How to Debug the ‘save_post’ Action?

Your code works just fine on my end. So, I’d say your problem is elsewhere. Troubleshooting guide. You can use standard debugging or FirePHP. I also use the following for cases where FirePHP doesn’t display information, i.e., save_post. function my_log( $msg, $title=”” ) { $error_dir=”/Applications/MAMP/logs/php_error.log”; $date = date( ‘d.m.Y h:i:s’ ); $msg = print_r( $msg, … Read more

Hooks for trashing, deleting, saving, restoring custom post type

Two action hooks run when a post is trashed wp_trash_post before the post is trashed and trashed_post afterwards. These run for any post type including attachments. See wp-includes/post.php If you want to limit your function to a specific post type you need to run a check in you callback function. function my_trash_action( $post_id ) { … Read more

How to influence the information displayed on widget inside wp-admin

Background: The reason why filtering with dynamic_sidebar_params doesn’t work with HTML is because WordPress strips HTML from Widget Heading in wp_widget_control() function like this: $widget_title = esc_html( strip_tags( $sidebar_args[‘widget_name’] ) ); WordPress also strips HTML in default JavaScript in wp-admin/js/widgets.js So without a customised solution, there is no default filter or option either with PHP … Read more

Valid characters for actions, hooks and filters

When you “hook”/add_action/*_filter(‘whatever’); a callback function to do_action(‘whatever’);, then you basically add the function (or object-method) name to the global $wp_filters-array. Doing so, you add the function/method name to an array that is built like the following $wp_filter[ $tag ][ $priority ][ $idx ] // $tag = action/filter name // $priority = 3rd argument / … Read more

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