How to make scheduled post preview visible to anyone?

Draft previews Take a quick look at this chunk of core code in query.php which [Checks] post status to determine if post should be displayed. http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php#L2658 if ( ! is_user_logged_in() ) { // User must be logged in to view unpublished posts. $this->posts = array(); } …is what makes it somewhat non-straightforward to bypass for … Read more

Publish post when edit post form submitted with enter/return pressed on keyboard

you may add a filter on wp_insert_post_data: add_filter( ‘wp_insert_post_data’, ‘my_force_publish_post’, 10, 2 ); function my_force_publish_post( $data, $postarr ) { if ( ! isset($postarr[‘ID’]) || ! $postarr[‘ID’] ) return $data; if ( $postarr[‘post_type’] !== ‘inventory’ ) return $data; $old = get_post( $postarr[‘ID’] ); // the post before update if( $old->post_status !== ‘draft’ ) { // force … Read more

I can’t preview post’s change once they are published

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

Display a post’s publish date from 2112

I had the same issue as you when I was dealing with events and wanted to show future events. Here is what I coded: add_action( ‘init’, ‘change_future_posts_to_post_now’ ); function change_future_posts_to_post_now() { remove_action(“future_post”, ‘_future_post_hook’); add_action(“future_post”, ‘publish_future_posts_now’, 2, 10); } function publish_future_posts_now($depreciated, $post) { wp_publish_post($post); } add_filter(‘posts_where’, ‘show_future_posts_where’, 2, 10); function show_future_posts_where($where, $that) { global $wpdb; if(“post” … Read more