There is a similar existing command (newspack-content-migrator hide-featured-images) in file (src/Command/General/PostsMigrator.php). After reviewing that command it would have been more work to refactor it for this new use case. The existing command requires a list of post ids and/or a category id. Our use case doesn't call for a list of post ids nor category id. Additionally the existing command needs to be called multiple times in order to process all rows (or use a very high posts-per-batch count that could take up too much processing power). The new command in this PR makes use of throttled_posts_loop to by pass this concern.
[x] (only for this new code) confirmed that PHPCS has been run
This general use CLI will add postmeta
newspack_featured_image_position = 'hidden'
to all posts that have a featured image.Usage:
wp newspack-content-migrator hide-all-featured-images
Output log:
hide_all_featured_images.log
Note:
newspack-content-migrator hide-featured-images
) in file (src/Command/General/PostsMigrator.php
). After reviewing that command it would have been more work to refactor it for this new use case. The existing command requires a list of post ids and/or a category id. Our use case doesn't call for a list of post ids nor category id. Additionally the existing command needs to be called multiple times in order to process all rows (or use a very highposts-per-batch
count that could take up too much processing power). The new command in this PR makes use ofthrottled_posts_loop
to by pass this concern.