wp-cli for Creating page-template

wp-cli is not a development tool, it is a server admin tool, as such all the scaffold stuff there is…. for lack of better word, unneeded bloat. It is unlikely to reflect best practice, especially if your copy is old. In the specific case of page templates, there is really nothing worth “scaffolding” the easiest … Read more

A shorter way to automatically update WordPress?

If you have this statement (by default) in your wp-config file define( ‘WP_AUTO_UPDATE_CORE’, true ); Then WP core files are automatically updated for you. This assumes that you have traffic to your site (if nobody ever visits your site, the updates won’t happen.) So your solution is actually causing more work by the server, and … Read more

How to delete a single post using wp cli in command line?

Please read the docs. It’s wp post delete POST-ID. # Delete post skipping trash $ wp post delete 123 –force Success: Deleted post 123. # Delete all pages $ wp post delete $(wp post list –post_type=”page” –format=ids) Success: Trashed post 1164. Success: Trashed post 1186. # Delete all posts in the trash $ wp post … Read more

WP CLI: search and replace specific directory name of URL

Instead of using ” to wrap your expressions, use ‘. Further experimenting shows me that this is incorrect—both ” and ‘ should work, as long as they’re matched (ie, you don’t accidentally try something like wp search-replace “domain.com/wp-content/uploads/(\d)/(\d)/(\d*)/’ “domain.com/wp-content/uploads/\$1/\$2/” –precise –all-tables –skip-columns=guid –regex. (Note that the regex in that example starts with ” and ends … Read more

Update custom plugin with WP-CLI

You would implement this: https://make.wordpress.org/core/2021/06/29/introducing-update-uri-plugin-header-in-wordpress-5-8/ First you would add a Update URI: header to your plugin with a custom domain. Second, you would add a filter to your plugin, using the filter name update_plugins_{$hostname} where {$hostname} is the value you gave your Update URI: . E.g. Update URI: example.com would have the filter update_plugins_example.com. In … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)