Articles of draft

l accidentally permanently deleted a Draft. There's any way I can recover it?

I recently started a blog and I was about to finish my second Post. I was cleaning up some stuff and decided to empty my Trash. I wasn’t paying much attention to it because I wasn’t expecting my Draft to be there. I accidentally deleted it. There’s any way I can at least visualize it […]

WordPress Comments are automatically publishing

I want to manually approve comments when someone will comment on any of the post. Right now when someone comment on any of the post these are automatically approved and published. I have changed settings in Discussion for comments but still these are automatically approved may be because the author of comment is admin. But […]

Why won't draft listings appear for non-admins?

I have a draft post with the author set to 5. User #5 is trying to view that draft on the front end using a WP_Query with the following arguments: array { [“name”]=> “example-52f00a8ba19f4” [“post_status”]=> array { [0]=> “draft” [1]=> “private” } [“post_type”]=> “customlisting” [“posts_per_page”]=> 1 [“author”]=> 5 } The user trying to view this […]

How to unpublish a page and still keep a draft?

I have a holiday sale page that no longer applies as the holidays have past. I want to keep the page for future design reference. I do not want the page to be accessible from the Internet. I tried: Setting the page status to Pending Review Setting the page status to Draft Neither of these […]

'Auto Draft' Post showing in wordpress loop

When running a wordpress loop, I am seeing these weird posts called auto draft. I have never seen this before. Does anyone know what they are and how to get rid of them? Any help is appreciated as I am lost on this one. THe loop I used is: <div class=”archive-steps-to-hs”> <div class=”container”> <div class=”row”> […]

change a post status when users update posts?

Is there an efficient way to change a post status from ‘published’ to ‘draft‘ when a user of a certain type tries to update their posts. I tried something along these lines function change_post_status($post_id) { if(current_user_can(‘rolename’)) { $current_post = get_post( $post_id, ‘ARRAY_A’ ); $current_post[‘post_status’] = ‘draft’; wp_update_post($current_post); } } add_action(‘pre_post_update’,’change_post_status’); The code looks good to […]

redirect deleted / drafted pages

A client asked me to unpublished a page, which I did. However, I kept it as a draft, just in case they wanted to republish at a future date. My issue is that anyone with this link will hit a 404 page, which I’ve read is generally a thing to avoid (Google apparently penalises you […]

'Archive' folder for posts and pages

Of course there is a Drafts section in Post and Pages, but how would I make an Archive section – which would contain previously published posts and page?

Changing status of Published posts which have less Content to “Draft”

function draftpost(){ global $wpdb; $prefix = $wpdb->prefix; $wpdb->query(“UPDATE “.$prefix.”posts SET post_status=’draft’ WHERE LENGTH( post_content ) <500”); } add_action(‘publish_post’, ‘draftpost’); This code is working Fine for changing Published Items to Draft. Issue is that this code removes my Custom Menu and make all Items in Menu to PENDING. How can I solve this?

Saving Custom Field Data before Publish

When creating a page or a post WordPress lets the content (title, body, featured image) be saved when using Ctrl + S. The Custom Fields do not save in the same way (in this case I’m using Advanced Custom Fields as well, but it happens without this plugin). Does anyone have a solution for saving […]