{"id":15528750,"url":"https://github.com/ernilambar/wp-cli-tips","last_synced_at":"2025-04-15T15:20:50.043Z","repository":{"id":102597037,"uuid":"80403595","full_name":"ernilambar/wp-cli-tips","owner":"ernilambar","description":"WP-CLI tips and tricks","archived":false,"fork":false,"pushed_at":"2024-09-09T04:58:54.000Z","size":6,"stargazers_count":11,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-30T13:03:33.066Z","etag":null,"topics":["wp-cli"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ernilambar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-30T08:12:17.000Z","updated_at":"2025-01-29T08:04:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"90dec9bd-2822-4cf0-a062-ad7bd23d6774","html_url":"https://github.com/ernilambar/wp-cli-tips","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ernilambar%2Fwp-cli-tips","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ernilambar%2Fwp-cli-tips/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ernilambar%2Fwp-cli-tips/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ernilambar%2Fwp-cli-tips/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ernilambar","download_url":"https://codeload.github.com/ernilambar/wp-cli-tips/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249094939,"owners_count":21211837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["wp-cli"],"created_at":"2024-10-02T11:14:54.726Z","updated_at":"2025-04-15T15:20:50.018Z","avatar_url":"https://github.com/ernilambar.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# WP CLI- Tips\nWP-CLI tips and tricks\n\n### Comments\n\n##### Empty trash.\n```\nwp comment delete $(wp comment list --status=trash --format=ids)\n```\n\n##### Approve all pending comments.\n```\nwp comment approve $(wp comment list --status=hold --format=ids)\n```\n\n##### Delete all spam comments.\n```\nwp comment delete $(wp comment list --status=spam --format=ids)\n```\n\n##### Mark all pending comments as spam.\n```\nwp comment spam $(wp comment list --status=hold --format=ids)\n```\n\n### Media\n\n##### Regenerate all thumbnails that have attachment IDs between 1000 and 2000.\n```\nseq 1000 2000 | xargs wp media regenerate\n```\n\n##### Regenerate all thumbnails that are set as Featured Image in pages.\n```\nwp media regenerate --yes $(wp post list --post_type=page --post_status=publish --format=ids | xargs -d ' ' -I % wp db query 'SELECT meta_value FROM wp_postmeta WHERE post_id=% AND meta_key=\"_thumbnail_id\"' --skip-column-names)\n```\n\n##### Import all jpgs in the current user's \"Pictures\" folder.\n```\nwp media import ~/Pictures/**\\/*.jpg\n```\n\n##### Import a local image and set it to be the post thumbnail for a post.\n```\nwp media import ~/Pictures/himalaya.jpg --post_id=123 --title=\"Himalaya range\" --featured_image\n```\n\n### Custom CSS\n\n##### Remove Custom CSS Post of all themes.\n```\nwp post delete $(wp post list --post_type=custom_css --format=ids)\n```\n\n##### Remove Custom CSS Post of a theme.\n```\nwp post delete $(wp post list --name=blue-planet --post_type=custom_css --format=ids)\n```\n\n##### Remove Custom CSS Post of currently active theme.\n```\nwp post delete $(wp post list --name=$(wp option get stylesheet) --post_type=custom_css --format=ids)\n```\n\n### Options\n\n##### Disable avatar.\n```\nwp option set show_avatars 0\n```\n\n##### Delete all options begining with \"theme_mods_\".\n```\nwp option list --search=\"theme_mods_*\" --field=option_name | xargs -I % wp option delete %\n```\n\n##### Delete all widget instances.\n```\nwp option list --search=\"widget_*\" --field=option_name | xargs -I % wp option delete %\n```\n\n### Widgets\n\n##### Delete all inactive widgets.\n```\nwp widget delete $(wp widget list wp_inactive_widgets --format=ids)\n```\n\n##### Move all widgets from \"sidebar-1\" to \"sidebar-2\" maintaining widget order.\n```\nprintf \"%s\\n\" $(wp widget list sidebar-1 --format=ids)|tac | xargs -I % wp widget move % --sidebar-id=sidebar-2\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fernilambar%2Fwp-cli-tips","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fernilambar%2Fwp-cli-tips","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fernilambar%2Fwp-cli-tips/lists"}