WordPress.org

Plugin Directory

Changeset 372624


Ignore:
Timestamp:
04/13/11 18:33:37 (3 years ago)
Author:
bergius
Message:

fixes a problem with permalinks not updating

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cms-page-order/trunk/cms-page-order.php

    r371219 r372624  
    2828 * - Dropdown for post states (set as another state) 
    2929 * - Check conflicts on each update 
    30  * – Set admin notice on update? 
    31  * – Make images into sprites 
     30 * - Set admin notice on update? 
    3231 * 
    3332*/ 
     
    110109    if ( !empty($_REQUEST['order']) ) { 
    111110        global $wpdb; 
    112         foreach ( $_REQUEST['order'] as $i => $page) {       
     111        foreach ( $_REQUEST['order'] as $i => $page ) { 
     112            $post_id = (int) $page['item_id']; 
    113113            if ($page['parent_id'] == 'root') 
    114                 $page['parent_id'] = 0; 
    115                  
    116             $data = array( 'menu_order' => $i, 'post_parent' => (int) $page['parent_id'] ); 
    117             $where = array( 'ID' => (int) $page['item_id'] ); 
     114                $parent = 0; 
     115            else 
     116                $parent = (int) $page['parent_id']; 
     117             
     118            $data = array( 'menu_order' => $i, 'post_parent' => $parent ); 
     119            $where = array( 'ID' => $post_id ); 
     120             
    118121            $wpdb->update( $wpdb->posts, $data, $where ); 
     122            clean_page_cache($post_id); 
     123 
    119124        } 
     125        global $wp_rewrite; 
     126        $wp_rewrite->flush_rules(false); 
    120127    } 
    121128    die(); 
Note: See TracChangeset for help on using the changeset viewer.