Tag Info

Hot answers tagged

6

You could hook into the action switch_blog. You get the new blog ID as the first argument here. But loading the complete translation files here is expensive, you also have to restore the old files after that. WordPress does not use native gettext functions, but some custom code that is much slower. See #17268. The performance penalty for that would be huge. ...


6

There is no special hook to author change. But you can achieve it by using post_updated hook. Example: add_action('post_updated', 'prefix_on_update_author', 10, 3); function prefix_on_update_author($post_ID, $post_after, $post_before) { if ($post_after->post_author != $post_before->post_author) { // author has been changed // ...


4

This wordpress plugin Simply Show Hooks will show you where all the action and filter hooks are, inline, in order, on the page you're looking at. You can see in the screenshot how it does it. One click to switch it on/off so you can quickly find the action of filter hook you're looking for.


3

First thing to mention is that you don't need to use wp_register_style if enqueuing within the same function. You can replace it with wp_enqueue_style and remove the duplicate. As for why your stylesheet isn't loading, start by checking the file path. Try this instead: wp_enqueue_style('cl-chanimal-styles', plugin_dir_url( __FILE__ ) . ...


1

have a look this plugin Simply Show Hooks which will show you where all the action and filter hooks are, inline, in order, on the page you're looking at, and all the actions or filter functions that have been hooked to them. You can see in the screenshot how it does it. It does just what you've asked.


1

If you are using the save_post action hook; then you can prevent the code from executing during an autosave with the following conditional: function do_not_autosave( $post ) { // Check to see if we are autosaving if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return; // Rest of the code here } add_action( 'save_post', ...


1

This one is actually surprisingly simple; add this to your wp-config.php file and all automatic updates will be blocked when outside of the specified hours: // Suspend updates when outside of business hours, 9:00 AM to 5:30 PM $updates_suspended = (date('Hi') < 0900 || date('Hi') > 1730); define( 'AUTOMATIC_UPDATER_DISABLED', $updates_suspended ); ...


1

As I said in the question post, I finally solved it by looking into the $_POST global. There's a $_POST['sticky'] field (valued as 'sticky') that is there just when a Post is sticky or is being made sticky, and it's not when a post is not sticky or is being unsticked.



Only top voted, non community-wiki answers of a minimum length are eligible