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:

LinkedIn WordPress Assessment Answers 2021

Which folder in a WordPress install is not affected by an automatic WordPress update? /wp-include /wp-admin /root ✅ /wp-content 2. You can harden your WordPress site security by adding______to your wp-config.php file? hashes and rCAPTCHA custom action hooks and filters database usernames and passwords unique keys and saits ✅ 3. In WordPress, what is the … Read more