diggy / polylang-cli Goto Github PK
View Code? Open in Web Editor NEWWP-CLI community package of Polylang commands
Home Page: https://github.com/diggy/polylang-cli
License: MIT License
WP-CLI community package of Polylang commands
Home Page: https://github.com/diggy/polylang-cli
License: MIT License
$ wp pll doctor language
Searching for updates...
Error: 'language' is not a registered subcommand of 'core'. See 'wp help core'.
$ wp cli version
WP-CLI 1.3.0
This enables Polylang thus all posts can be managed, e.g. by wp post list
~/.wp-cli/commands/polylang-enable/command.php
<?php
if ( ! defined( 'PLL_ADMIN' ) ) define( 'PLL_ADMIN', true );
if ( ! defined( 'PLL_SETTINGS' ) ) define( 'PLL_SETTINGS', true );
~/.wp-cli/config.yml
require:
- commands/polylang-enable/command.php
Please consider mentioning it. It took me 20 minutes to find out.
Hello,
First of all, thank you for your work.
I'd like to install your package but I encounter some problems.
If I try : wp package install diggy/polylang-cli
I get : Error: Invalid package
And with : wp package install [email protected]:diggy/polylang-cli.git
I get : PHP Fatal error: require(): Failed opening required '/root/.wp- cli/packages/vendor/diggy/polylang-cli/vendor/autoload.php'
.
What is the right way to do it ? Thank you very much.
Hello @diggy,
Won't it be a good idea to offer the possibility to create posts in a specific language and link them?
wp pll post create
would look like wp post create
but with the ability to pass the language.wp pll post bind
would mimic pll_save_post_translations
to bind posts created in 1.My use case is to generate for every new website a basic structure with some pages ( Home, Contact, Blog, ... ) that are available in English and French by default and then add Home as frontpage with wp option update page_on_front
. This currently doesn't work because, in order to update the option, polylang checks that the given id is translated and bound to a translation in every language.
Hi,
I'm using the pro version of polylang and i'm willing to set the license through the wp-cli but the option doesn't appear after:
wp pll option list
In fact, this option is under another namespace
wp option list | grep license
polylang_licenses
Is there anyway to handle that ?
Thanks!
Hey there,
i would like to try out your very promising package, as the developers of polylang obviously do not yet have any interest in providing a CLI interface.
However when trying to install the pakcage, i get the following errors:
wp package install [email protected]:diggy/polylang-cli.git
Installing package diggy/polylang-cli (dev-master)
Updating /home/www-data/.wp-cli/packages/composer.json to require the package...
Registering [email protected]:diggy/polylang-cli.git as a VCS repository...
Using Composer to install the package...
Loading composer repositories with package information
Updating dependencies
Resolving dependencies through SAT
Dependency resolution completed in 0.016 seconds
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Conclusion: remove wp-cli/wp-cli 2.2.0
- diggy/polylang-cli dev-master requires wp-cli/wp-cli ~1.5.0 -> satisfiable by wp-cli/wp-cli[v1.5.0, v1.5.1].
- diggy/polylang-cli dev-master requires wp-cli/wp-cli ~1.5.0 -> satisfiable by wp-cli/wp-cli[v1.5.0, v1.5.1].
- Can only install one of: wp-cli/wp-cli[v2.2.0, v1.5.0].
- Can only install one of: wp-cli/wp-cli[v2.2.0, v1.5.1].
- Installation request for wp-cli/wp-cli 2.2.0 -> satisfiable by wp-cli/wp-cli[2.2.0].
- Installation request for diggy/polylang-cli dev-master -> satisfiable by diggy/polylang-cli[dev-master].
Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements ablocking the update you have to resolve those problems.
Error: Package installation failed (Composer return code 2).
Reverted composer.json.
Do you know how to fix this, so the future users can enjoy your tool even with the newest version of wp-cli?
Did you ever think about submitting your polylang-cli project to the official polylang project? I think this would be really useful and maybe they would take over the maintenance for you also .:)
Greetings!
Hello @diggy !
Could you give Tiny translation cache a try on a site with persistent object cache?
https://github.com/szepeviktor/wordpress-plugin-construction/blob/master/tiny-translation-cache.php
It may come handy for you.
because I'm lazy
PHP Notice: Undefined index: hook_suffix in /usr/local/var/www/vhosts/localhost/pll/wp-admin/includes/class-wp-screen.php on line 229
PHP Stack trace:
PHP 1. {main}() /usr/local/Cellar/wp-cli/1.3.0/php/boot-fs.php:0
PHP 2. include_once() /usr/local/Cellar/wp-cli/1.3.0/php/boot-fs.php:17
PHP 3. WP_CLI\bootstrap() /usr/local/Cellar/wp-cli/1.3.0/php/wp-cli.php:23
PHP 4. WP_CLI\Bootstrap\LaunchRunner->process() /usr/local/Cellar/wp-cli/1.3.0/php/bootstrap.php:75
PHP 5. WP_CLI\Runner->start() /usr/local/Cellar/wp-cli/1.3.0/php/WP_CLI/Bootstrap/LaunchRunner.php:23
PHP 6. WP_CLI\Runner->_run_command() /usr/local/Cellar/wp-cli/1.3.0/php/WP_CLI/Runner.php:985
PHP 7. WP_CLI\Runner->run_command() /usr/local/Cellar/wp-cli/1.3.0/php/WP_CLI/Runner.php:330
PHP 8. WP_CLI\Dispatcher\Subcommand->invoke() /usr/local/Cellar/wp-cli/1.3.0/php/WP_CLI/Runner.php:323
PHP 9. call_user_func:{/usr/local/Cellar/wp-cli/1.3.0/php/WP_CLI/Dispatcher/Subcommand.php:401}() /usr/local/Cellar/wp-cli/1.3.0/php/WP_CLI/Dispatcher/Subcommand.php:401
PHP 10. WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}() /usr/local/Cellar/wp-cli/1.3.0/php/WP_CLI/Dispatcher/Subcommand.php:401
PHP 11. call_user_func:{/usr/local/Cellar/wp-cli/1.3.0/php/WP_CLI/Dispatcher/CommandFactory.php:81}() /usr/local/Cellar/wp-cli/1.3.0/php/WP_CLI/Dispatcher/CommandFactory.php:81
PHP 12. Polylang_CLI\Commands\StringCommand->list_() /usr/local/Cellar/wp-cli/1.3.0/php/WP_CLI/Dispatcher/CommandFactory.php:81
PHP 13. PLL_Table_String->__construct() /usr/local/var/www/vhosts/localhost/pll/vendor/diggy/polylang-cli/src/Commands/String.php:65
PHP 14. PLL_Table_String->__construct() /usr/local/var/www/vhosts/localhost/pll/wp-content/plugins/polylang/settings/table-string.php:25
PHP 15. convert_to_screen() /usr/local/var/www/vhosts/localhost/pll/wp-admin/includes/class-wp-list-table.php:143
PHP 16. WP_Screen::get() /usr/local/var/www/vhosts/localhost/pll/wp-admin/includes/template.php:2054
cf. #61
When I run `wp pll lang url nl` # features/steps/when.php:29
Then STDOUT should contain: # features/steps/then.php:15
"""
http://example.com/?lang=nl
"""
$ wp pll lang url nl
http://example.com/
exit status: 0
By default when you use WP CLI it will assign the post to the default language.
So for example if I have Norsk and Finish and Norsk is set as default, if I run this command: wp post create --post-content="test" --post_status="publish" --post_title="test"
I expect the post to be assigned to Norsk language.
But when I activate the Polylang-CLI package then when I use standard WP CLI the post is no longer assigned to the default language.
In my opinion the expected behaviour should be that a 3rd party package should not affect the standard WP CLI in any way.
Hello @diggy,
As I told you in a different post, I use your package with Ansible. The problem that I encounter is that If I run wp pll lang delete --all
or wp pll lang list --format=count
, I get an error. In my ansible task, I would like to delete languages if they exist before adding other languages.
So would it be possible to have a flag to perform a delete even if there are no languages or at least return 0 instead of an error if I try to list the languages with format=count ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.