• I would like to write a plugin which reverses the chronological order posts are displayed in the Edit Posts page of the WordPress administration panel.

    The following post shows how to change the hard coding of the wp-admin/includes/post.php file, but this needs to be accomplished without changing the core wordpress files.

    The function that needs to be changed is wp_edit_posts_query() as the above article points out.

    The block of code as it appears normally is:

    if ( isset($q['post_status']) && 'pending' === $q['post_status'] ) {
    		$order = 'ASC';
    		$orderby = 'modified';
    	} elseif ( isset($q['post_status']) && 'draft' === $q['post_status'] ) {
    		$order = 'DESC';
    		$orderby = 'modified';
    	} else {
    		$order = 'DESC';
    		$orderby = 'date';
    	}

    To accomplish this task, it needs to be changed to:

    if ( isset($q['post_status']) && 'pending' === $q['post_status'] ) {
    		$order = 'ASC';
    		$orderby = 'modified';
    	} elseif ( isset($q['post_status']) && 'draft' === $q['post_status'] ) {
    		$order = 'ASC';
    		$orderby = 'modified';
    	} else {
    		$order = 'ASC';
    		$orderby = 'date';
    	}

    Basically, just changing DESC to ASC.

    Any help would be appreciated.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Admin Interface Reverse Chronological Order’ is closed to new replies.