Modify Notification Message When Profile Updated

You will have to use a gettext filter as there are no hooks or filters associated with your request. function custom_user_message($translation, $text){ if(‘Profile updated.’ == $text){ $current_user = wp_get_current_user(); $foo_condition = ”; //Do some checking here for user custom field if(!$foo_condition) return $text.’ Custom Message’; } return $translation; } add_filter( ‘gettext’, ‘custom_user_message’, 10, 2 );

add_action hook for publish_post not working

When a post is published/saved, it does not do it in a single script execution. It redirects to a different script, does the save, then redirects back to where you started. If you want to confirm that your hook is working, use update_option(), and delete the option immediately after displaying it so it’s not latent … Read more

Turning on output buffering in a wordpress plugin

Although I realise this is probably not the right way to go about it, I managed to turn on output buffering using the following code in my plugin: add_action(‘init’, ‘rsq_buffering’); function rsq_buffering() { ob_start(); } I probably should be doing any session stuff from within the init hook instead of just all over the place.

How to use a WooCommerce action hook?

If you don’t intend your meta field to be specific to a particular product type you can do the following ( which is what I do in my own WooCommerce extension ). function new_post_meta () { if (isset($_POST[‘location’])) update_post_meta( $post_id, ‘location’, json_encode($_POST[‘location’]) ); } add_action( ‘woocommerce_process_product_meta’, ‘new_post_meta’ ); or to limit this to a particular … Read more

Divs appearing everywhere in post content

You first should find out where the divs are coming from, since that’s not normal behavior. Could be from a plugin or – as Damien said – copy-pasting a text from Word. To remove the divs you can do a simple str_replace(array(‘<div>’, ‘</div>’), ”, $content) either before storing the text in the database (by hooking … Read more

Change the look of the media uploader

As starting point there is this action that allows inserting CSS and Javascript into the upload window. add_action( ‘admin_head-media-upload-popup’, ‘wpse_70750_style_upload_iframe’ ); function wpse_70750_style_upload_iframe() { ?> <style type=”text/css”> #media-upload, #media-upload .media-item .slidetoggle { background-color:#555 } </style> <script type=”text/javascript”> jQuery(document).ready( function($) { }); </script> <?php } Other Q&A’s that use this hook may be interesting. Then, you … Read more

Filter WooCommerce Orders

WooCommerce does not support this specific scenario. The primary issue in this case being that WooCommerce processes orders at the order level NOT the line item level. So if a customer were to order items from multiple sellers you create a situation that will cause serious problems and headaches. When the first seller marks the … Read more

‘save_post’ hook not working in WP 3.5

attachment_fields_to_save is still called. Just tried out this on my wordpress 3.5. installation and the following code killed wordpress when saving an image. add_filter(‘attachment_fields_to_save’, function() { die(‘attachment_fields_to_save’); });