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

Update status of all posts in a category

I am sure there’s an easier way to accomplish this, but this how I would’ve done. Query all posts with category X and status X Update query results with status Y. $target_category = ‘news’; $change_status_from = ‘draft’; $change_status_to = ‘publish’; $update_query = new WP_Query(array(‘post_status’=>$change_status_from, ‘category_name’=>$target_category, ‘posts_per_page’=>-1)); if($update_query->have_posts()){ while($update_query->have_posts()){ $update_query->the_post(); wp_update_post(array(‘ID’=>$post->ID, ‘post_status’=>$change_status_to)); } } You can … Read more

Display author name, outside the loop, if they haven’t published a custom post

author’s name or logged in user’s name? can use global $current_user; or wp_get_current_user(); if the user is logged in. if( is_user_logged_in() ) { $current_user = wp_get_current_user(); echo $current_user->user_firstname; } for specific user role you can check $current_user->roles array. Reference: https://codex.wordpress.org/Function_Reference/wp_get_current_user https://codex.wordpress.org/Function_Reference/get_currentuserinfo

problem with publish date not always appearing [duplicate]

From the the_date() documentation: Will only output the date if the current post’s date is different from the previous one output. i.e. Only one date listing will show per day worth of posts shown in the loop, even if the function is called several times for each post. [Emphasis mine] You’re almost certainly looking for … Read more

Do action for only switch status for publish_post

You can use the transition_post_status hook, which is fired whenever the status is changed. So to perform an action when the status is changed to publish, you’d do this: function notificationApprove( $new_status, $old_status, $post ) { if ( ‘publish’ === $new_status && ‘publish’ !== $old_status && ‘post’ === $post->post_type ) { // Send mail } … Read more