WordPress API – Get Drafts
I think the query parameter that you want for post status is: status=draft Let me know if this doesn’t work.
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
The database table for users holds the user_status as integer: $users_single_table = “CREATE TABLE $wpdb->users ( ID bigint(20) unsigned NOT NULL auto_increment, user_login varchar(60) NOT NULL default ”, user_pass varchar(255) NOT NULL default ”, user_nicename varchar(50) NOT NULL default ”, user_email varchar(100) NOT NULL default ”, user_url varchar(100) NOT NULL default ”, user_registered datetime NOT … Read more
This is what normal query run by wp_get_associated_nav_menu_items() looks like: SELECT wp_posts.* FROM wp_posts INNER JOIN wp_postmeta ON ( wp_posts.id = wp_postmeta.post_id ) WHERE 1 = 1 AND wp_posts.post_type=”nav_menu_item” AND (( wp_posts.post_status <> ‘trash’ AND wp_posts.post_status <> ‘auto-draft’ )) AND (( wp_postmeta.meta_key = ‘_menu_item_object_id’ AND Cast(wp_postmeta.meta_value AS CHAR) = ‘3111’ )) GROUP BY wp_posts.id ORDER … Read more
This is a little “hacky”, but when you call get_permalink and you need the permalink for a draft, provide a clone of your post object with the details filled in: global $post; if ( in_array( $post->post_status, array( ‘draft’, ‘pending’, ‘auto-draft’ ) ) ) { $my_post = clone $post; $my_post->post_status=”publish”; $my_post->post_name = sanitize_title( $my_post->post_name ? $my_post->post_name … Read more
I rarely deal with cookies and not sure about complete mechanics there, but here is basic working example of passing current user’s cookies to retrieve preview page source: $preview_link = set_url_scheme( get_permalink( $post->ID ) ); $preview_link = esc_url( apply_filters( ‘preview_post_link’, add_query_arg( ‘preview’, ‘true’, $preview_link ) ) ); $cookies = array(); foreach ( $_COOKIE as $name … Read more
You cannot assign capabilities to unknown users. If you want to make a post visible for everyone, create a separate URL for these posts and add a control element to the post editor to enable the preview on selected posts only. When such an URL is called, check if a preview is allowed for the … Read more
Since a picture is worth a thousand words: 1) Click “Edit” next to “Publish Immediately” 2) Change the date 3) Click “OK”
It should be possible to add a button to the Publish box Save as changed copy. You have to hook into content_save_pre then and copy the content and all meta data into a new post with a draft status. After the review the posts have to be merged back. I haven’t done this yet, but … Read more