Tag Info

Hot answers tagged

14

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 it is really needed.


12

Since a picture is worth a thousand words: 1) Click "Edit" next to "Publish Immediately" 2) Change the date 3) Click "OK"


8

Absolutely. Above the publish button, where it says 'publish immediately', click edit and select the date/time you'd like it to publish. The buttons will say 'Schedule' after you save the new date.


8

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 post and if the post hasn’t been published already. Also make sure ...


7

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>'; return $date; ...


6

Hi @e100; If you were interested in a custom plugin solution I can envision several approaches. A process similar to what @toscho described as "Save as Changed Copy" but with some subtle differences. The plugin could lock editing of published posts but allow you to create derived posts with a new status like "Updated Draft" which could be tied back to the ...


5

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 ...


4

http://wordpress.org/extend/plugins/revisionary/ This plugin will do what you want. It creates a role Revisor that is kind of in between Contributor and Editor. The UI could be improved and the internal code had to work around a lot of WordPress' missing features, but yeah, this solves your problem: It will allow you to save a draft (actually a 'pending' ...


4

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 question, to link to a draft simply enter the URL ...


3

You need to programmatically set the slug as you do so. An SQL trigger could do the trick. Don't forget to mind duplicate slugs as you write it. Else, instead of publishing using the database, write a php script that calls the WP API.


3

maybe an easy solution: the plugin http://wordpress.org/extend/plugins/duplicate-post/ for copy a post


3

I'm not sure why it is modifying the data like that when displaying, but you can use $post->post_date_gmt This will return the scheduled post date the same as it is in the DB except it's in GMT time format, so you might need to convert the time to your local time zone first (this blog post may help). Otherwise, you should be able to use it as is if ...


3

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 ) ) ); ...


3

Not at this time, unfortunately. If the page/post is already published, your only recourse would be to create a new page/post to hold your edits and privately publish it so your colleague can check your changes. Then replace the content on your live page/post with the revised version. Just FYI: Making draft-status changes to already published content is a ...


3

The get_posts method of WP_Query is what does the heavy lifting as far as getting the posts to display. Before it does anything, however, there's a hook called pre_get_posts that you can hook into. The hooked function will receive a reference (pointer) to the current query object. So you can change the query vars to be whatever you'd like. So... <?php ...


3

post_status is part of the $post object which you can use to determine if it is published, a draft, pending, etc. if( $post->post_status == 'pending' ) // do stuff


3

Since editor displays projected permalink for slug editor, it must have some way to figure it out. From looking at source that is handled by get_sample_permalink_html() and get_sample_permalink(). Since we only need link without form cruft, we can rework it into something like: function get_draft_permalink( $post_id ) { require_once ABSPATH . ...


2

I used this as a solution for hiding draft pages. You can hide the (draft page) menu items with the li.draft class. add_filter('nav_menu_css_class' , 'nav_menu_add_post_status_class' , 10 , 2); function nav_menu_add_post_status_class($classes, $item){ $post_status = get_post_status($item->object_id); $classes[] = $post_status; return ...


2

Change published to publish. $args = array ( 'post_type' => 'step_to_hs', 'post_status' => 'publish', ); // The Query $query = new WP_Query( $args ); Reference WP_Query status parameters


2

There is indeed processing in WP_Query which might prevent posts from displaying if they are not simply public. Since there are several conditions there it is a little hard to guess why it fails in your specific case. It might be issue with how permissions are setup or some edge case (which querying for non-public posts is full of).


2

There's a plugin called Live drafts that seems to work quite well? http://wordpress.org/extend/plugins/live-drafts/


2

This is a little "hacky", but when you call get_permalink and you need the permalink from 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 = 'published'; $my_post->post_name = ...


2

I recently was dealing with the exact same problem. I didn't solve it, and we decided that since people had to pay a relatively large sum for their listings that they would be sufficiently incented not to post bad stuff. Plus it would be a pain to manually approve each one -- people don't like waiting a day to get results. So we gave our directory_member ...


2

I believe the file responsible is wp-includes/js/autosave.js. There is a dev version for easy reading.


2

The easiest solution is to add a specific class to the menu items that you want to hide. And then hide them through CSS. ^ click to enlarge ^ The CSS classes are not visible by default, you have to enable it in the Screen Options upper tab. If your theme does not print the relevant classes in the <body> tag, this will do: add_filter( ...


2

See: Writing Posts (emphasis added): To schedule a post for publication on a future time or date, click "Edit" in the Publish area next to the words "Publish immediately". You can also change the publish date to a date in the past to back-date posts. Change the settings to the desired time and date. You must also hit the "Publish" button ...


2

Create a .php file in root of your WordPress directory and write: <?php require( 'wp-load.php' ); $urunler = array( 'order' => 'ASC', 'post_type' => 'urun', 'post_status' => null, 'numberposts' => -1, ); $tumurunler = get_posts($urunler); if ($tumurunler) { foreach ($tumurunler as $urun) { ...


1

You probably need to modify the columns displayed in your Custom Post posts list, so that the list isn't dependent solely on Post Title. I have a similar situation, with a Custom Post Type that consists solely of a "featured image" (and a "link" custom metabox). I modified the Post list to output the image, which linked to the edit-post page. You may need ...


1

try pasting this in your theme's functions.php file add_filter( 'parse_query', 'display_autosave_and_revisions' ); function display_autosave_and_revisions( $query ) { global $pagenow,$typenow; if ( is_admin() && $pagenow == 'edit.php' && $typenow == "post") { $query->query_vars['post_type'] = array('revision','post'); ...


1

I'm posting this as another solution for you and its based on the page id /* $post_id - The ID of the post you'd like to change. $status - The post status publish|pending|draft|private|static|object|attachment|inherit|future|trash. */ function change_post_status($post_id,$status){ $current_post = get_post( $post_id, 'ARRAY_A' ); ...



Only top voted, non community-wiki answers of a minimum length are eligible