I need to overwrite the records from the custom type of records in the reverse order. I tried to add such code to the functions.php file.
$args = array( 'numberposts' => -1, 'post_type' => 'otcheti' ); $othecti = get_posts($args); $othecti_revers = array_reverse(get_posts($args)); for ($i = 0; $i < count($othecti); $i++) { $newOthect = $othecti_revers[$i]; $newOthect->ID = $othecti[$i]; wp_insert_post($newOthect); } Unfortunately, no rewriting takes place. Tell me, what could be the matter?
Maybe there is some easier way to overwrite posts in a custom post type in reverse order?