Useful Snippets


This blog is used to collect useful snippets related to Linux, PHP, MySQL and more. Feel free to post comments with improvements or questions!

Are your smart devices spying on you? Make better purchasing choices and find products that respect your privacy at

RSS Latest posts from my personal blog

Most viewed posts

Subscribe to RSS feed

Force WordPress security upgrade to latest minor version

Stanislav KhromovStanislav Khromov

Create a file in the WP root directory called force-minor-update.php and call it via your web browser.

Use this code:

require( dirname(__FILE__) . '/wp-load.php' );

//Clear transients
global $wpdb;
$sql = "DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_%'";
$clean = $wpdb->query( $sql );

//Clear object cache

//Attempt auto update

Original source


Web Developer at Aftonbladet (Schibsted Media Group)
Any opinions on this blog are my own and do not reflect the views of my employer.
Twitter Profile
Visit my other blog

Comments 3
  • Richard Benn
    Posted on

    Richard Benn Richard Benn

    Reply Author

    I speak CSS and PHP at the kindergarten level. Is there an existing plugin that can do the work?

  • DrLightman
    Posted on

    DrLightman DrLightman

    Reply Author

    If you want to use the underscore in like sql statement as a literal, you have to escape it, otherwise it works as a single character wildcard. Maybe there you have to escape with two backslashes since it’s inside a php string too.

  • Seven
    Posted on

    Seven Seven

    Reply Author

    Thank you, used your script to upgrade an old WordPress, from 4.8 to 4.8.9 without any problem. Sometimes you don’t want to upgrade an old website to the last WordPress version because it can break plugins or themes. Upgrading to the last minor version takes advantage of security and bug updates, without the risk off breaking the website.