In what sequence are the hooks fired when a post is “published”?

What exactly do you mean with “published”? One thing you can try is this : http://planetozh.com/blog/my-projects/wordpress-hooks-filter-flow/ The script runs in your WordPress root (or in /wp-admin/ if you prefer) and enumerates filters that are loaded in your blog. Hooks are displayed alphabetically, and for each hook, active filters (or actions, they’re the same) are listed … Read more

How to change post status in hook?

You get the full post object as a second parameter on save_post. Use it to change the status just like the following code. add_action( ‘save_post’, ‘wpse_78351_status’, 10, 2 ); function wpse_78351_status( $post_ID, $post ) { remove_filter( current_filter(), __FUNCTION__ ); if ( ‘trash’ !== $post->post_status ) //adjust the condition { $post->post_status=”draft”; // use any post status … Read more

When a user creates a post (pending), send a confirmation link that allows them to publish

You need a function that hook into post status transitions and send and email containing a link with some verification variables and a function that takes that variables, check them and if all ok update posts status. Following code I think is self-explanatory, and comments give additional help: add_action(‘new_to_pending’, ‘send_approve_link’); add_action(‘draft_to_pending’, ‘send_approve_link’); add_action(‘auto-draft_to_pending’, ‘send_approve_link’); add_action(‘init’, … Read more

How to show an error message after publishing a post?

I wouldn’t use that hook. Here’s why Try something like this using admin_notices. function wpsites_admin_notice() { $screen = get_current_screen(); if( ‘post’ == $screen->post_type && ‘edit’ == $screen->base ){ ?> <div class=”error”> <p><?php _e( ‘Updated Demo Message!’, ‘wpsites’ ); ?></p> </div> <?php }} add_action( ‘admin_notices’, ‘wpsites_admin_notice’ ); Untested.

I can’t preview post’s change once they are published

This is probably not the best way to do it since it wont persist after wordpress updates (but hopefully the update will correct it. In wp-admin/includes/post.php ,edit the post_preview() function just before returning the apply_filters( ‘preview_post_link’, $url ); put the following code: //ORIGINAL //$url = add_query_arg( $query_args, get_permalink( $post->ID, true ) ); //CHANGES to make … Read more

How to limit user to publish post per day and per role?

You can use my plugin Posts Creation Limits which has a per user, per role, per post type, per post status limiting system and combined with its post_creation_limits_custom_checks action hook and check if the user has created a post that day already – if so: show the the “limit reached message”. For example: add_action( ‘post_creation_limits_custom_checks’, … Read more

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