How to fix curl error 60: SSL certificate problem: certificate has expired error

From September 30, 2021, WordPress websites that use Let’s Encrypt certificates are having issues with HTTP API requests. For example, here is an example that will cause this error: $res = wp_remote_get( ‘’ ); if( is_wp_error( $res ) ){ echo $res->get_error_message(); } the error message: cURL error 60: SSL certificate problem: certificate has expired What causes this error? … Read more

How to display a random WordPress post inside a page

Here is a handy snippet that displays a random post, so each time a user refreshes the page a different post will appear. The snippet should be saved as a PHP template for pages and a page has to use it. Step 1. Create a new file random.php inside your active theme folder and put … Read more

How to use wp_delete_post to delete post or pages

wp_delete_post function allows us to permanently delete posts, pages, attachments. When a post is deleted, all the associated content will also be deleted, this includes the comments, custom fields, and category entries. Instructions Parameter PARAMETER TYPE DESCRIPTION DEFAULT REQUIRED $postid intiger article ID 0 no $force_delete boolean skip recycle bin and delete permanently false no … Read more

Use mysql2date to convert date string obtained from the database into a readable date

Instruction: Parameter PARAMETER TYPE DESCRIPTION DEFAULT REQUIRED $format string Output can be PHP date format or Unix timestamp. no yes $date string mysql2date() only recognizes “Ymd H:i:s” format, so the original timestamp string needs to be converted to this format. no yes $translate boolean If true, the specified date and format string will be passed … Read more

How to display user roles in the WordPress comments

This is another neat feature that I needed but didn’t really want to use another plugin to accomplish it. To display user roles inside WordPress comments like on the image above 👆 use the following code snippet: