Send email when publish new post in certain categories

You can use transition_post_status function, then fetch users and send an email to all users. Here is a sample code, it’s not tested. But it will get you started with this. function wcs_send_mail_on_publish_category_posts( $new_status, $old_status, $post ) { global $post; if ( ‘publish’ !== $new_status or ‘publish’ === $old_status ) return; if ( in_category( array( … Read more

Ajax function on #publish only saves as draft – how to make it publish?

Perhaps this solution will work: var flag_ok = false; $(‘#publish’).on(‘click’, function (e) { if ( ! flag_ok ) { e.preventDefault(); var url = shiftajax.ajaxurl; var shift = $(‘#post_ID’).val(); var data = { ‘action’: ‘wpaesm_check_for_schedule_conflicts_before_publish’, ‘shift’: shift, }; $.post(url, data, function (response) { if( response.action == ‘go’ ) { // there aren’t any scheduling conflicts, so … Read more

Assign published posts to another user automatically

You can try using wp_insert_post_data for the task. Something like: function assign_new_post_to_specific_author( $data , $postarr ) { // Where author_ID is the ID of the author you want to assign the new post $data[‘post_author’] = author_ID; return $data; } add_filter( ‘wp_insert_post_data’, ‘assign_new_post_to_specific_author’, ’99’, 2 ); Tried it on c9.io and it works, but you need … Read more

Add Password Generator on password protected page

It is not possible to modify the post submit meta boxes with a filter. But you can do that with JavaScript. This script will generate 10-12 random alphanumeric string and put it in the password field (if it is empty) when you click the Password protected radio button. $(‘#visibility-radio-password’).click(function () { // If there is … Read more

What is happening to make my Update/Publish button disabled?

Without seeing your specific situation, I cannot say whether this is what’s causing your issues or not, but this is my best guess. WordPress has this cool thing called the Heartbeat API. It pings the server periodically while you’re logged in and in the WordPress admin. It does a number of things to help improve … Read more

do more action after I publish a post

There are a number of hooks you can use, such as publish_post or save_post, e.g.: // an example of a post save hook add_action( ‘save_post’, ‘diligents_post_save_hook’ ); function diligents_post_save_hook( $post_id ) { //verify post is not a revision if ( !wp_is_post_revision( $post_id ) ) { // do things } } save_post will fire on publish … Read more

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