Have you ever encountered a situation when you were in the middle of writing a SQL query and thought, “if only I could write a quick PL/SQL function for this, it would make this quick and easy?” But, unfortunately, you don’t have any privileges to create any functions in the schema. Luckily, since Oracle Database 12c, there is an answer for you.
Continue reading “How to write an anonymous PL/SQL function and use it in your SQL statement”Setup free Let’s Encrypt SSL/TLS Certificates for NGINX Reverse Proxies
If you have your website running behind an NGINX Reverse Proxy, you may be wondering how you can enable HTTPS traffic to your Reverse Proxy server using your website’s domain. Luckily the setup is quick, easy, and free thanks to Let’s Encrypt. You may also want to check out the amazing Using Free Let’s Encrypt SSL/TLS Certificates with NGINX guide from the NGINX team themselves.
Continue reading “Setup free Let’s Encrypt SSL/TLS Certificates for NGINX Reverse Proxies”How to auto-mount an NFS share using systemd
If you want to auto-mount an NFS share during boot time, you may run into the issue that by the time the auto-mount procedure is being executed, the network is not yet up and hence the mount of the NFS share will fail. Luckily, there is an easy way around it by using systemd
and let it worry about when to mount the share.
How to disable and remove WordPress post revisions
By default, WordPress stores revisions for all your posts when you draft or update them. It’s a useful feature when you want to go back to previous versions of your posts and/or restore them. However, you may not really care about revisions and if you run a WordPress site long enough, these revisions will accumulate, unnecessarily bloating the wp_posts
table and taking up space in the database. Luckily there is a simple way to limit or disable the revisions altogether and remove those that are already stored in the database.
tl;dr
- Change the WordPress revision behavior
- To disable, add
define('WP_POST_REVISIONS', false);
to yourwp-config.php
file. - To limit the revisions, add
define('WP_POST_REVISIONS', <max revisions>);
to yourwp-config.php
file, where<max revisions>
is the number of maximum revisions that you would like to keep per post.
- To disable, add
- Connect to the WordPress database and run
DELETE FROM wp_posts WHERE post_type='revision';
Disable post revisions
To disable post revisions, you have to set the WP_POST_REVISIONS
parameter to false
, which you can do by adding the following instruction into your wp-config.php
file:
define('WP_POST_REVISIONS', false);
Limit post revisions
If you rather want to limit the number of revisions that WordPress stores, you can specify the maximum number instead of false
. For example, to only allow a maximum of 3 (+1 autosave), specify:
define('WP_POST_REVISIONS', 3);
Remove post revisions
Post revisions are stored as separate entries in wp_posts
with the column post_type='revision'
. To clean them up, simply execute the following statement in the database:
DELETE FROM wp_posts WHERE post_type='revision';
Once your statement has finished, you have successfully removed old WordPress post revisions.
Free sample data of our solar system
About two years ago I introduced a couple of free sample data sets on GitHub (https://github.com/gvenzl/sample-data). You can read the entire back story of them in this blog post. Back then I stated, “Over time, my aim is to provide more such data sets in that repository, however, I am in no rush to do so. So don’t expect to see anything anytime soon“. Well, that time has now come. Last year my wife and I visited the Kennedy Space Center in Florida which reignited my curiosity about space. I was always very interested in space and space travel and last year I finally fulfilled a childhood dream of mine seeing the Apollo capsules and Space Shuttles with my own eyes. Back then I joked with my wife about how cool it would be to try and put data about our solar system together and sure thing not long after I couldn’t resist any longer and started looking into it.
Continue reading “Free sample data of our solar system”