Elegantly prune post revisions

WordPress will trim revisions on a post when creating new revisions, this is how it does it at the end of wp_save_post_revision: // If a limit for the number of revisions to keep has been set, // delete the oldest ones. $revisions_to_keep = wp_revisions_to_keep( $post ); if ( $revisions_to_keep < 0 ) { return $return; … Read more

post visibility history

By default WordPress can display changes in post content, by using the post revisions feature. WordPress can however not by default show any changes in post status (or publish date, or author, etc.). However there are plugins that can solve this. I built one myself called Simple History that displays more information about the changes … Read more

Revisions function ¿disabled?

It’s not a good idea to run old versions of WordPress. Fortunately, you can quite easily turn off post revisions by using the wp_revisions_to_keep filter. Add the following code snippet to a plugin, or to your active theme’s functions.php file: add_filter( ‘wp_revisions_to_keep’, ‘wpse_368635_disable_revisions’ ); function wpse_368635_disable_revisions( $revisions ) { // Setting the value to 0 … Read more

Browsing Revisions in Custom Post Types takes me Empty Post Listing

This had to do with the user not having the CPT capabilities access set up properly. I was setting custom capabilities as such: ‘capabilities’ => array( ‘publish_posts’ => ‘publish_’ .$this->type, ‘edit_posts’ => ‘edit_’ .$this->type, ‘edit_others_posts’ => ‘edit_others_’ .$this->type, ‘edit_published_posts’ => ‘edit_published_’ .$this->type, ‘delete_posts’ => ‘delete_’ .$this->type, ‘delete_others_posts’ => ‘delete_others_’ .$this->type, ‘read_private_posts’ => ‘read_private_’ .$this->type, ‘edit_post’ … Read more

Page edit auto-creates blank revision and editor

The problem turned out to be the transition from utf8 encoded databases to utf8mb4. Apparently the editor was getting a silent error and defaulted to dropping the transaction. The Solution: Recently WordPress has started switching to using utf-8mb4, so most people probably need to change their charset <meta charset=”UTF-8″ to <meta charset=”UTF-8mb4″>. Very old and … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)