change a post status when users update posts?
Have you tried to use “wp_insert_post_data” instead of “pre_post_update”?
Have you tried to use “wp_insert_post_data” instead of “pre_post_update”?
If by draft, you mean “autosave”, you can consider using this plugin: http://wordpress.org/extend/plugins/wp-feature-disable/ If you want to disable revisions, instead…try this: define(‘WP_POST_REVISIONS’, ‘false’); You can put that in your /wp-config.php file and it should immediately take effect. Any previously saved revisions in your database will need to be purged. You can do it by running … Read more
Caveat: the code examples within this answer are very basic and may or may not need further conditional logic to adapt to your precise needs, this logic is meant as an example to get you on your way. There’s two considerations you need to be aware of: Consideration 1: If you add a new post … Read more
There is probably a better way but you could add the following CSS to your stylesheet, which will add a little banner when viewing a page that has a status of draft. .status-draft.hentry:before { content: “Previewing a Draft”; background: #87C5D6 !important; display: block; text-align: center; } You could also use these classes for the different … Read more
Yes, as you – so far – have no publish date. You could use $post->post_modified, which will always be the date of the latest modification to the post data. Debug: Try hooking into the filter and dump both vars: function date_dump_callback( $date, $d ) { echo ‘<pre>’; print_r( $date ); print_r( $d ); echo ‘</pre>’; … Read more
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
Do you have any kind of cache plugin used? Perhaps to help speed up the website. If Yes that just may be the issue here. Another suggestion is change the current active theme to any default WP theme (twentyThirteen, TwentyFourteen), and then see if Preview give you an issue. If it does not, then its … Read more
I think the query parameter that you want for post status is: status=draft Let me know if this doesn’t work.
I should start off by saying that linking to drafts will only work for logged in users (with appropriate permissions) – other users will simply hit a 404 Not Found! You’d be much better off getting all your content ready & published, or only link to it once it is ready! Nevertheless, to answer your … Read more
I had a similar problem and here is the best solution I could come up with. The reason (I think) that private or non-published items show up in menus is that the menu items are themselves posts and have their own post_status. That means that in a situation where a page is marked private, the … Read more