WP CLI – show users whose ID is larger than given ID

One way to work with existing WP-CLI commands is through the WP_CLI::runcommand(). Here are two examples how we can filter an existing WP-CLI command, namely the wp user list command based on WP_User_Query and it’s pre_user_query hook: Run a custom script in WP-CLI Let’s write our script.php file with: <?php add_action( ‘pre_user_query’, ‘wpse_pre_user_query’ ); WP_CLI::runcommand( … Read more

PHP warning are displaying when using WP CLI [closed]

The first thing to check for this issue is the WP_DEBUG, WP_DEBUG_LOG and WP_DEBUG_DISPLAY constants in the wp-config.php file. They have to be set to false or be commented out (the default value is false). Else, no matter which global log_errors, display_errors or error_reporting settings you have, you will still see those warnings when running … Read more

What is the difference between the Package Language and the Site Language?

As you probably already know, WordPress supports language packs. Translation files that reside in wp-content/languages. Those are used to translate all the strings the user sees in WordPress. WordPress also allows translation teams on WordPress.org to provide localized release packages. These already come with the translation files included, plus a bit more. They can translate … Read more

wp-cli with MAMP shows sh: mysql: command not found

It looks like you probably don’t have mysql in your path. From the command prompt, you should be able to run ‘mysql’ and enter the mysql interactive environment. If you see something like ‘command not found.’ then keep working on that path. There are few different ways to set up your path, I prefer to … Read more

Import Media To CPT with CLI & Filter Custom Taxonomy

In WP-CLI list the arguments in WP_Query are defined by the associated arguments like –post_type=post. To be able to filter custom taxonomies you would need to use tax_query. Unfortunately WP-ClI does not support argument array so it is not possible. It is on the other hand possible with the WP-CLI Rest package. You can install … Read more

wp-cli create post and media import

There is just to display images BUT you can specify in which size the image(s) will be displayed. By default it’s size=”thumbnail”. Simply set it to size=”full” to just get one full-sized image: $ wp post create –post_title=”Foobar” –post_content=”” More gallery shortcode options can be found on wordpress.com: https://en.support.wordpress.com/gallery/#gallery-shortcode

WP-CLI over SSH – wp command not found

Found a solution here https://github.com/hrsetyono/wordpress/wiki/WP-CLI-on-Webfaction . This seems to be Webfaction specific issue You simply need to open FTP and append this line in /home/yourname/.bashrc export PATH=$PATH:$HOME/bin

WP-CLI update date and time format

The wp-cli command structure would be: wp option update timezone_string “American/New_York” So: option to act on a WordPress option update to update the option the option name, in this case ‘timezone_string’ the new value, in this case ‘American/New_York’ Items 3 and 4 are defined by WordPress, a plugin, or other custom code. Number 4, the … Read more

Can I create multiple pages at once using WP-CLI?

There are a few ways. As mentioned, post generate. wp post generate –count=10 –post_type=page –post_date=1999-01-04 curl http://loripsum.net/api/5 | wp post generate –post_content –count=10 You could write your own custom command. See the List of community commands for examples or the package index. <?php /** * Implements example command. */ class Example_Command extends WP_CLI_Command { /** … Read more

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