Change Post and CPT author on the fly while publish the post
You need to hook into the save_post action filter, get the post meta field, and swap the ID’s and fire the update_post function.
You need to hook into the save_post action filter, get the post meta field, and swap the ID’s and fire the update_post function.
The DB space run out, I had to wait for the hosting to make space and extend the DB size to the amount I requested.
I’ve done it. Here is the post with answers on publishing a post marked as scheduled. Been running the code for 2 years on the site in question and it’s reliable. Marking future dated post as published
function looks fine, $single = true might be causing your problem, replace it with true
Add these two where you want them to display within your single.php file. It will make the title of the post a link. <?php previous_post_link(); ?> <?php next_post_link(); ?> EDIT: Sorry I missed the second part of your question about future posts. Here’s what I would probably do. It’s not tested, but will give you … Read more
It can be achieved by scheduling the post time to current time + a few seconds for example. Each time you add a custom field, just before saving – change the publish time to the current time and then save.
As far as I can see, you won’t get any indication a post was previously published, as wordpress remembers only the old versus new transitions. I recommend you add some meta data, that is use add_action(‘publish_post’, ‘your_function’) (or similar) to do update_post_meta($post->ID, ‘post_published’, ‘on’). That way, every post gets an indicator when it’s published – … Read more
Those are some dangerous words “public…can enter data directly to the DB” You could write your own form and use wp_insert_post() Something like this: $new_post = array( ‘comment_status’ => ‘closed’, ‘ping_status’ => ‘closed’, ‘post_author’ => 1, // id of admin, or some other user ‘post_title’ => $_POST[‘title’], ‘post_name’ => $_POST[‘title’], ‘post_status’ => ‘draft’, ‘post_type’ => … Read more
Using transistion_post_status I’m able to retrieve post meta. add_action( ‘transition_post_status’, ‘post_published’, 10, 3 ); function post_published( $new_status, $old_status, $post ) { if ( $old_status != ‘publish’ && $new_status == ‘publish’ ) { $meta = get_post_meta($post->ID); echo ‘<pre>’; var_dump($meta); echo ‘</pre>’; die(); } }
Adding a Custom ‘Now’ button under ‘Published on’ header to return current date and time