List all shortcodes from all WordPress posts with WPCLI

If you used shortcodes from a certain plugin or a theme and then stop using either one, then chances are that you still have shortcodes that no longer translate into anything. In this guide We will be using WP CLI Shortcode scrapper package to find all shortcodes in the database. This command works by searching … Read more

Create WP-CLI Aliases

IF you use the same commands often you can save them as aliases so that you have them always available. For example, the following commands will check if WP core, installed plugins and themes have updates available: You can combine the commands into a one-liner: and you can create an alias for this command: so … Read more

Delete Unused Post Revisions

Post revisions are a WordPress feature that allows you to undo changes and go back to an earlier version of your posts and pages, it works by auto-saving every 60s while you edit content. Since revisions can take up a lot of space in the database, it is a good idea to delete them. or You … Read more

5 Easy ways to Create a WordPress Admin user

Here are five different methods to create a new WordPress Admin user. In all of the examples below I will use the following username/password combination, so make sure to change it before running any of the commands: username123 change username123 with your username password123 change password123 with your password [email protected] change [email protected] with your email … Read more

Change image URL in WordPress database

Many users choose to host their images on an external service to reduce the load on their hosting. If you are interested in doing this, you will only have to change the location of all the images that you have already uploaded. To do this, you need to make two SQL queries in your database: 1. … Read more

Yoast SEO is (kind of) incompatible with PHP8

Yoast SEO is compatible with PHP 8 and PHP 8.1 but the Composer that YoastSEO is using doesn’t yes support PHP 8.0 so you might experience problems when editing posts&pages in WordPress. According to this comment there are still 19 other PHP version incompatibilities remaining to be fixed. 😲 So turns out that YoastSEO is … Read more

Purge cache from W3 Total Cache plugin using WP-CLI

Here are some useful commands to clear cache from the terminal with wpcli: cdn_purge purge URLs from CDN and Varnish flush all flushes all cache related to W3TC (Page Cache, OC, DB Cache, Minify, etc.) flush page flushes pages cache only flush posts flushes both pages & posts cache flush database flush object flush minify

How to setup JS and CSS environment files for WordPress plugin development

I got the method I’ll describe below from Krasen Slavov, who shared it on his blog back in December ’21, and I’ve been using it for my WordPress plugins ever since. If you require anything more complicated with eslint, stylelint, and PHP standards, I recommend using Composer + nodeJS, or looking into Gulp. Requirements … Read more

Reset WordPress user password using WP-CLI

In this guide We’ll cover how to reset a WordPress user password using WP-CLI. Step 1. Ensure WP-CLI is installed and you are in the website directory run the following command to check if you are in the right folder: Step 2. List all users and note user_login for the user Step 3. Replace the … Read more