Category: WordPress

Regenerate thumbnails with WP-CLI

You can easily regenerate thumbnails with WP-CLI, just type $ wp media regenerate –yes in the command line. The –yes flag answers yes to the confirmation message. WP-CLI documentation

Search and replace content with WP-CLI

$ wp search-replace ‘[shortcode_1]’ ‘[shortcode_2]’ wp_posts –skip-columns=”post_title,post_name” Replaces [shortcode_1] with [shortcode_2] from wp_posts table and skips columns post_title and post_name. Add –dry-run flag if you want to see the results without applying changes.

WordPress loop post count

$wp_query->post_count contains number of posts being displayed. $wp_query->found_posts contains total number of posts found with current criteria.