I have a custom post type called "meetings" and I will like to bulk remove all the posts and all of its attachment images... Can this be done with the wp-cli? thank you!
I see an option ([--post_date=<post_date>]) in wp-cli, but how can we use wp-cli to update all my published posts date randomly? For example, I want all posts date changed randomly between 01-01-2021 to 01-01-2022, how can I do this using cli?
Yesterday, I found out that a website I worked on as a writer (I have no admin access) had been injecting malicious Javascript code in all its pages, as described in this article by Luke Leal. According to that article, a fake Wordpress plugin musts have been installed on that website to inject the malicious code. I want to draw your attention to this section of the malicious code: // This code is defined inside a PHP class... function save_striplple_plugin() …
I'm toying around with writing custom wp-cli commands. I have successfully created a simple command, wp-cli theme save which runs a script to backup the site's theme files: <?php class Save_Command extends WP_CLI_Command { /** * Create a tarball of current active theme and save it to wp_themes directory in the user's config directory. * * @synopsis */ public function __invoke($args = array(), $assoc_args = array()) { exec ( 'wpst' ); } } WP_CLI::add_command( 'theme save', 'Save_Command' ); This code …
Wordpress has a "Site Icon" feature that serves correctly-sized favicons and so on to browsers. Is there a way to drive this feature programmatically, eg. by uploading media and setting an option with wp cli?
I tried use wp-cli theme install with option url from my dropbox link. But unfortunately, I got this problem: PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature This mean my zip file is corrupt. But I tried upload it through wordpress dashboard and it's work good. I tried again with free theme in wordpress.org/themes and it's work good too, so maybe the problem in my vps setting? Maybe someone meet this problem, has resolved it and …
Today I noticed that \WP_CLI\Utils\wp_clear_object_cache() has been marked as deprecated in WP-CLI 1.5.0. The release notes don't mention anything about it. What should be used, instead? Do I still need to take care of flushing the cache myself or is it handled automatically now, like mentioned here?
I know we have the following command available in WP-CLI to remove transients # Delete all transients $ wp transient delete-all However, my question is does it remove transients on all sites over multi sites? If not how can we remove transients on all sites?
I am trying to use the wp import cli in the terminal to import a large wxr file (200MB) from the old test server to new test server. I can login to wp-admin using the admin account and mysql cli mysql -u user -p so I know that my db information is correct. But when I use wp import command, returns db error Error Establishing a database connection. Is there any part that I am missing? I am checking other …
I need to set a couple of Theme Mods to boolean and array values using WP CLI but can't find any way to do achieve it. I have already tried the following for booleans, but they appear to be treated as string: wp theme mod set my_theme_mod true wp theme mod set my_theme_mod 1 For arrays, I don't even know where to start, so have not tried anything yet. Any pointers please?
How can I find out what pages and post on a site contain a particular reusable block? Typically, to find content on a site, I issue wp db search *itemlookingfor* (like the post ID, part of a file name, or a word) OR wp db query 'SELECT ID FROM the_posts_table WHERE post_content LIKE "%itemlookingfor%" AND post_status="publish"' In my case, I used the reusable block's ID and no results were returned for either command. I replaced the ID of the reusable …
We're migrating a site from dev to production using wp-cli to replace all occurrences in the database for the url, just like in the search-replace example. (http://example.dev to https://example.com) wp search-replace finds and replaces all occurrences that it reported finding. However, there are still many lingering in the database, especially in serialized data. But, WP-CLI says that it handles serialized data as well. If I run wp db search 'http://example.dev' --all-tables I get 20 more occurrences of the string. If …
After using WPML Media, a plugin that creates duplicates of each image for each language, we now have almost 100,000 duplicate images that we're not going to use and need to get rid of. We need to not only delete these from the filesystem itself, but also need to make sure that deleting all references in the database as would typically happen if one were to manually delete them through the media gallery. I'm looking for a WP-CLI solution, if …
On a Ubuntu 20.04 Linode I have a Wordpress installation. I deploy the website using https://github.com/Mixd/wp-deploy, a Capistrano deployment tool. When the website is deployed the folder structure is like this: current folder points to the actual release (virtual host points to this folder) inside of current there are: wordpress folder with all the Wordpress core files and the content folder which is wp-content renamed and contains plugins, themes, uploads On my wp-config.php file are defined: define('WP_CONTENT_URL', 'https://website.com/content'); define('WP_SITEURL','https://website.com/wordpress'); WP …
I made a custom plugin for inserting staging / production versions of a Google Tag Manager container based on the server's IP address. How do I make it compatible with WP-CLI so it will update when I run the wp plugin update --all command?
I regularly need to create a batch of posts of a custom post type, with names and meta values that follow a regular pattern. This seems like a perfect canditate for using wp-cli, but so far it hasn't worked. Using wp-cli, if I enter: wp post create --post_title='test' --post_status='draft' post_type='class_notes' I get an error: Unable to read content from 'post_type=class_notes'. However wp-cli is definitely able to connect to this post type, as the following returns a proper list of labels …
When I use WP-CLI I'm having some issues with the wp db export and wp db import commands. I have a local site on my desktop that I would like to migrate to my laptop so I can work on it. So I go on my desktop, navigate to the appropriate directory and type wp db export. It is a success and creates the file: ccv3-2018-07-12-4e523fb.sql Now here is the part I don't get. I copy paste the SQL file …
I'm trying to install/configure wp-cli for my WordPress website but I keep getting an error everytime I try and run a command. I have a VPS server with Bluehost and I followed a simple installation guide but I keep getting an error related to running a command as root in which I add the --allow-root tag but now I get the error below: Error: Strange wp-config.php file: wp-settings.php is not loaded directly. How can I fix this?