Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.
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?

share|improve this question
    
are you trying to change all existing posts with "less content" to draft, or just the post that is being published? –  aaronwaggs Jan 7 '13 at 5:50
    
I am trying to change all posts with less content to draft and this action happens when user is posting new post. –  Naveen Sharma Jan 7 '13 at 7:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.