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?
I have a PHP script that I need to run as a cron job. However this script needs access to the WP API (get_pages(), get_post_meta() and get_permalink() specifically). I've followed the instructions at http://codex.wordpress.org/Integrating_WordPress_with_Your_Website, but to no avail. Code: require_once('../../../wp-blog-header.php'); $args = array( 'child_of' => 2083 ); $pages = get_pages($args); However when I run php -q this_file.php from the command-line I get the following output: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <meta http-equiv="Content-Type" content="text/html; …
I’ve inherited a strange site, where the posts in the backend are built not in the WP editor, but in a series of ACF repeater blocks. I need to format / migrate these posts in a way that they can be parsed by the block editor. There are thousands of posts so this process really has to be programmatic. I know the CLI lets me access the value of the content field in a post: wp post get 123 --field=content …
I have tried to install Wordpress CLI on my windows machine running windows 10. But for some reason everytime i try to run the wp Command it says 'sh' is not recognized as an internal or external command,operable program or batch file. I have tried multiple times to reinstall it and set it up from scratch with different guides but it just won't work. This is what the bat file says @ECHO OFF SET BIN_TARGET=%~dp0/./wp-cli.phar php "%BIN_TARGET%" %* This is …
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.
In Ubuntu 20.04 wp-env is giving me error once i have installed it and while trying to start it with wp-env start .The error showing is mysqlcheck: Got error: 1130: Host '172.29.0.5' is not allowed to connect to this MariaDB server when trying to connect. I have tried....... CREATE USER 'wp'@'%' IDENTIFIED BY 'newpass'; GRANT ALL PRIVILEGES ON *.* TO 'wp'@'%'; sudo service mysql restart . Changed the wp-config with new user and password keeping the DB_HOST same as earlier …
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=http://blogs.democratandchronicle.com/fleet-feet-beat/ --dir=/root/wordpress_exports --file_item_count=100000000 PHP Notice: date_default_timezone_set(): Timezone ID 'America/New York' is invalid in phar:///usr/bin/wp/php/wp-cli.php(21) : eval()'d code on line 16 PHP Notice: Constant ABSPATH already defined in …
On a fresh WordPress install in Linux distributions, wp-config-sample.php contains Carriage Return control characters that are not found in any other .php file in the distribution. Running egrep -l $'\r'\$ *.php in WP's base dir, will return only wp-config-sample.php I am not worried about eliminating the control character, nor am I worried that it interferes with install operations (it doesn’t). I’d just like to find out if there’s a reason why wp-config-sample.php is the only file with this anomaly. WP …
Below is the output from my attempt to update wp-cli on Windows 10. Clearly another version is available. Can someone please explain how to make this work? C:\Users\HP>wp cli update Error: You can only self-update Phar files. C:\Users\HP>wp cli check-update +---------+-------------+-----------------------------------------------------------------------------+ | version | update_type | package_url | +---------+-------------+-----------------------------------------------------------------------------+ | 1.1.0 | major | https://github.com/wp-cli/wp-cli/releases/download/v1.1.0/wp-cli-1.1.0.phar | +---------+-------------+-----------------------------------------------------------------------------+
Softaculous seems to always adds junk to the installs I don't want. Such as example posts, pages, plugins, and starter themes. How do I remove them all for a fresh start?
I have the post ids and urls. I need to extract the post content make some modifications and update again. I have more than 2,000 posts hence I would like to do it using WP CLI and not manually. Can I know how do I do that? EDIT : I need to take the entire text and - change the fonts. Remove some html tags. add some internal links. Append with a link to our facebook and twitter page. Include …
I'm runnning this command; sudo -u www-data wp search-replace www.siteurl.com www.newsiteurl.com --recurse-objects --skip-columns=guid --skip-tables=wp_users From command line: 3.456 replacements From bash-script: 0 replacements the line in the bash script: wp search-replace ${OLD_URL} ${NEW_URL} --recurse-objects --skip-columns=guid --skip-tables=wp_users I've tried trimming the variables, I've tried ${VAR} and $VAR, and even --path=/path/to/site The output table with details about replacements comes out on both bash and command-line versions. 0 replacements for the bash-script and 3.456 replacements from command line.
I'm running multisite. Looking to replace old URLs with new URLs for pulling a copy of the site form one environment to another environment. Here is my command: wp search-replace --url=domain.com https://domain.com https://domain.test --all-tables --network --recurse-objects --skip-columns=guid --dry-run --allow-root --debug WP-CLI is just taking my command and going to a new line, then returns nothing. When I add --debug this is what I get back: Debug (bootstrap): No readable global config found (0.093s) Debug (bootstrap): Using project config: //wp-cli.yml (0.094s) …
I have a page that has a new template, and I want to set that new template with wp-cli. When I wp post get <id> I get an output like the following: +-----------------------+---------------------+ | Field | Value | +-----------------------+---------------------+ | ID | 4 | | post_author | 5 | | post_date | 2012-03-09 13:11:38 | | post_date_gmt | 0000-00-00 00:00:00 | | post_content | | | post_title | Home Page | | post_excerpt | | | post_status | publish | …
I of course have ConnectBot, but I'm looking for something I can script. Edit: To clarify here, I'm not interested in running scripts from a terminal. What I want to do is run an SSH command in an automated/scheduled manner. Tasker and Locale Execute are the equivalent of cron, all I need is the 'ssh' command to run from the script.
That's the shortest way I know to install the WordPress shell extension WP-CLI: curl https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar > /usr/local/bin/wp && chmod +x /usr/local/bin/wp Is there an even shorter way? Note: I use Ubuntu 16.04.
I read near the end of this guide regarding utilizing SSHguard to protect WordPress from Brute force attacks that after configuring SSHguard the relevant way, one must: disable XML-RPC by blocking all remote access to /xmlrpc.php in your web server configuration. I don't use XML-RPC in any of my websites. I use Nginx as my web server. I'm not sure what is the best way to totally block XML-RPC. Nginx conf for each site? WP-CLI operation per site? What is …
I have a command line script for maintaining a wordpress plugin and have to load the wordpress core to be able to access wordpress functions. This problem is very similar to Initialize WordPress environment to use in a real cron script. Though it differs from it as the referred question is supposed for use with a (real) cron script which can be accomplished otherwise then by starting a command line php script. As the referred question is already answered and …