entity-command
entity-command copied to clipboard
`wp post generate` without any arguments sets post status to future
Bug Report
- [x] Yes, I reviewed the contribution guidelines.
- [x] Yes, more specifically, I reviewed the guidelines on how to write clear bug reports.
Describe the current, buggy behavior
I'm having a problem when trying to generate posts without the --post_date argument. As per official documentation, the default post status is set to publish. However, when simply run wp post generate it creates 100 posts that are set for future publish (post status = future). On top of that, the Date column in the Dashboards shows an error messages Missed schedule. What's also strange, I get the same result when I explicitly set the --post_status=publish.
Describe how other contributors can replicate this bug
wp post generate --count=5wp post list- the post_status column showsfutureas the status
Describe what you would expect as the correct outcome
I expect to create posts with publish post status.
Let us know what environment you are running this on
I have tried to execute this command with both the 7.4.29 and 8.1.6 PHP version. It's a fresh installation. I don't have any plugins installed. Attached below my timezone settings as well.
OS: Darwin 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:46:32 PDT 2022; root:xnu-8020.101.4~15/RELEASE_ARM64_T6000 arm64
Shell: /bin/zsh
PHP binary: /opt/homebrew/Cellar/[email protected]/7.4.29/bin/php
PHP version: 7.4.29
php.ini used: /opt/homebrew/etc/php/7.4/php.ini
MySQL binary: /opt/homebrew/bin/mysql
MySQL version: mysql Ver 15.1 Distrib 10.7.3-MariaDB, for osx10.17 (arm64) using EditLine wrapper
SQL modes: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir: phar://wp-cli.phar/vendor
WP_CLI phar path: /Users/marcin/Desktop/wp-cli
WP-CLI packages dir: /Users/marcin/.wp-cli/packages/
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.6.0
Provide a possible solution
If you happen to have a suggestion on how to fix this bug, please tell us in here.
Just leave this section out if you don't know how to fix it.
Provide additional context/Screenshots
Thanks for the report, @marcinkrzeminski !
Were you able to figure out the cause?
@danielbachhuber turned out it's a problem on my machine. Here's my setup
- macOS 12.15.1
- Laravel Valet and all dependencies installed via Homebrew
- wp-cli installed via Homebrew
Running generate command on a remote server works like expected. Any ideas how I could debug this on my local machine?
Running generate command on a remote server works like expected. Any ideas how I could debug this on my local machine?
@marcinkrzeminski Dang, that's tough.
I don't have any great ideas on how to debug at the moment. The discrepancy seems to be between $post_date_gmt and gmdate( 'Y-m-d H:i:s' ) https://github.com/WordPress/wordpress-develop/blob/ef326a6545ef353dccb9e8384a02ffaabb2854c6/src/wp-includes/post.php#L4228-L4240
Feel free to stop by #cli on WordPress.org Slack if you want help debugging further.