Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




_relocate_children [ WordPress Function ]

_relocate_children ( $old_ID, $new_ID )
Access:
  • private
Parameters:
  • (unknown_type) $old_ID
  • (unknown_type) $new_ID
Returns:
  • (unknown)
Defined at:



Move child posts to a new parent.

Source


<?php
function _relocate_children$old_ID$new_ID ) {
    global 
$wpdb;
    
$old_ID = (int) $old_ID;
    
$new_ID = (int) $new_ID;

    
$children $wpdb->get_col$wpdb->prepare("
        SELECT post_id
        FROM 
$wpdb->postmeta
        WHERE meta_key = '_wp_attachment_temp_parent'
        AND meta_value = %d"
$old_ID) );

    foreach ( 
$children as $child_id ) {
        
$wpdb->update($wpdb->posts, array('post_parent' => $new_ID), array('ID' => $child_id) );
        
delete_post_meta($child_id'_wp_attachment_temp_parent');
    }
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics