Articles of command line

Do you have to have command line access to use Subversion with WordPress?

My group does not have command line access to the machine that is running our WordPress instance. However, we would still like to install/update using Subversion. Is this possible? Also, does Subversion need to be on the same machine?

Initialize WordPress environment to use in a real cron script

I have to run a PHP script through real cron (WP cron being too unreliable). Within that script, I need $wpdb to insert data into WordPress table. But of course $wpdb will not be available as WordPress would not be initialized. Right? So, my question is how to ‘include’ WordPress/initialize WordPress environment to do such […]

How to determine wordpress base path when wordpress core is not loaded

I have a command line script for maintaining a wordpress plugin and have to determine the wordpress base path to be able to load the wordpress core. I could just assume the script is several levels under the base path. But if I want to reuse the code and I have another similar script that […]

Generate WP-CLI @alias for each site on multisite

I have a few multisites, each with several sites, that I want to auto-generate @aliases for. Is there way to sync those sites as aliases in my site list? I’d like to be able to target a single site without having to specify –url= and using the last part of the url seems like a […]

How do I pass an array as an argument to a WP-CLI command?

I want to use WP-CLI to create some new posts with custom taxonomy terms assigned. The challenge is that wp_insert_post’s tax_input argument only accepts arrays, which I would have to specify on the command line. According to the codex, here is the format required: $post = array( ‘tax_input’ => [ array( ‘taxonomy_name’ => array( ‘term’, […]

wp-cli displays php notices when display errors off

I am using wp-cli and I am having php notices and errors show up when running wp-export. Some of these warnings and errors are ending up in the output file. How can I force errors to NOT show up. I have tried ini_set(‘display_errors’, 0); and error_reporting(0); in wp-wp-config.php root@roc-apache-4:/var/www/blogs/html# wp export –quiet=true –debug=false –url= –dir=/root/wordpress_exports […]

How do I delete all generated images from my server except those currently used in posts

I have a new set of image sizes for my site’s in-development theme. My server is filled with old image sizes, most of which have never been used. You’ve heard this one before, right? The Question How do I delete all WP generated thumbnails from my server but not those thumbnails currently used in posts? […]

Is it possible to export WordPress from command line?

Is it possible to export WordPress from command line? I don’t mean use mysqldump to export the database, but create the xml file used to easily import to another WordPress installation.

How To Export/Import WordPress (MySQL) Database Properly Via Command-Line?

Normally, a MySQL database can be exported and imported using these simple SSH commands: Export: mysqldump -u USERNAME -p DATABASE_NAME > filename.sql Import: mysql -u USERNAME -p DATABASE_NAME < filename.sql But it’s not that simple when it comes to WordPress. From what I see, additional parameters need to mentioned, such as –add-drop-table for instance. The […]

Where/how are categories stored?

Disclaimer: I am new to WordPress. When I add categories to my blogging site, where/how are these categories stored? If I want to change the names of these categories in batch, without having to go through the point-and-click UI, how would I go about it? Would this be done through a command-line interface?