‘transition_post_status’ only fires when pressing “Add New”

This will do something when you publish a post in the backend. function my_publish( $post_id ) { if ( ( $_POST[‘post_status’] === ‘publish’ ) && ( $_POST[‘original_post_status’] != ‘publish’ ) ) { error_log(‘WordPress would be better if it did not use Google Fonts. Looking forward to the system fonts.’); } } add_action( ‘publish_yourCustomPostType’, ‘my_publish’, 10, … Read more

add filter to “quick edit menu” in wordpress admin

You do not want to reference the global $post, but the post that is given to you as one of the argument. You simply need to remove global $post; Remember also to sanitize input and prefix function names. function wpse50651_filter_transition_post_status( $new_status, $old_status, $post ) { global $wpdb; $wpdb->query( $wpdb->prepare( “UPDATE my_table SET post_status=%s WHERE post_id=%d”, … Read more

1 day after custom date change post status to draft

Your question isn’t very clear. Do you mean: 1 day after koncerter_start_date all posts with custom-post-type koncert have to get the status draft? EDIT Code: add_action( ‘wp_loaded’, ‘concert_daily_tasks’ ); function concert_daily_tasks() { $current_url = “https://” . $_SERVER[‘HTTP_HOST’] . $_SERVER[‘REQUEST_URI’]; if ( $current_url == ‘https://example.com/concert-daily-tasks’ ) { // <– set the correct URL! check_concert_status(); } } … Read more

Create front end link to save post (or unpublish post) as draft

You can use wp_update_post() to change the status of a post. global $current_user; get_currentuserinfo(); $post_id = $_GET[‘post_id’]; $the_post = get_post( $post_id ); if ( $the_post->post_author == $current_user->ID && $the_post ) { $the_post->post_status=”draft”; wp_update_post( $the_post ); } Use wp_insert_post() with post_status => ‘draft’ to save a post.

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