mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-04 17:20:07 +00:00
Revisions changes.
* Eliminates the bloated Revisions meta box in favor of 'Revisions: #' in the publish box. * Adds ability to compare autosave to current post, when revisions are disabled. * Makes autosaves stand out visually, including "Restore This Autosave". Also: * Adds missing capability check for restoring a revision. * When no revision matches the post's current modified time, avoid marking an autosave as 'current'. * Fixes wp_get_post_autosave() to return an autosave even when revisions are disabled. * Add 'check_enabled' arg to wp_get_post_revisions(); false avoids the wp_revisions_enabled() check. * Adds a responsive slider that is narrower for fewer versions. props markjaquith. see #24804. git-svn-id: https://develop.svn.wordpress.org/trunk@24790 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -157,7 +157,7 @@ function wp_save_post_revision( $post_id ) {
|
||||
* @return object|bool The autosaved data or false on failure or when no autosave exists.
|
||||
*/
|
||||
function wp_get_post_autosave( $post_id, $user_id = 0 ) {
|
||||
$revisions = wp_get_post_revisions($post_id);
|
||||
$revisions = wp_get_post_revisions( $post_id, array( 'check_enabled' => false ) );
|
||||
|
||||
foreach ( $revisions as $revision ) {
|
||||
if ( false !== strpos( $revision->post_name, "{$post_id}-autosave" ) ) {
|
||||
@@ -369,11 +369,15 @@ function wp_delete_post_revision( $revision_id ) {
|
||||
*/
|
||||
function wp_get_post_revisions( $post_id = 0, $args = null ) {
|
||||
$post = get_post( $post_id );
|
||||
if ( ! $post || empty( $post->ID ) || ! wp_revisions_enabled( $post ) )
|
||||
if ( ! $post || empty( $post->ID ) )
|
||||
return array();
|
||||
|
||||
$defaults = array( 'order' => 'DESC', 'orderby' => 'date' );
|
||||
$defaults = array( 'order' => 'DESC', 'orderby' => 'date', 'check_enabled' => true );
|
||||
$args = wp_parse_args( $args, $defaults );
|
||||
|
||||
if ( $args['check_enabled'] && ! wp_revisions_enabled( $post ) )
|
||||
return array();
|
||||
|
||||
$args = array_merge( $args, array( 'post_parent' => $post->ID, 'post_type' => 'revision', 'post_status' => 'inherit' ) );
|
||||
|
||||
if ( ! $revisions = get_children( $args ) )
|
||||
|
||||
Reference in New Issue
Block a user