2017-04-15 5 views

답변

0

Cpanel 또는 데이터베이스 액세스 권한이있는 경우 DB 패널에서이 쿼리를 실행할 수 있습니다.

update table wp_posts set status='draft' where post_type='property_listing' 

그렇지 않으면,이 코드를 사용합니다.

add_action('init','change_mypost_status'); 
function change_mypost_status(){ 
    $args = array(
     'post_type' => 'property_listing', 
     'posts_per_page' => -1 
    ); 
    $the_query = new WP_Query($args); 
    if ($the_query->have_posts()) { 
     echo '<ul>'; 
     while ($the_query->have_posts()) { 
      $the_query->the_post(); 
      $current_post = array(
        'ID'   => get_the_ID(), 
        'post_status' => 'draft' 
      ); 
      // Update the post into the database 
       wp_update_post($current_post); 
     } 
     wp_reset_postdata(); 
    } 
} 
(테마의 function.php에 붙여 넣습니다)