A WP-CLI script to scrape all blog posts for shortcodes ( registered or not ) and provides you a report after complete with CSV capability.
This is a shortcode scraper with multisite compatability. The scraper will walk over any site you specify looking for
shortcodes. All found shortcodes in posts will be put together for a report, which is output at the end of the operation.
Pull requests are always welcome
( showing the output in console )
( showing the resulting CSV output )
composer require jaywood/jw-shortcode-scraper
If you happen to use the sweet Composer Installers library, this CLI script is
marked as a wp-cli-package
for ease of use later.
wp-content/mu-plugins/jw-wpcli-shortcode-scraper/
( Name is up to you )wp-content/mu-plugins
call it whatever you want, I use init.php
<?php
if ( defined( 'WP_CLI' ) && WP_CLI ) {
require_once 'jw-wpcli-shortcode-scraper/jw-shortcode-scraper.php';
}
Now since your init.php
file is in wp-content/mu-plugins
it will always load.
wp jw-shortcode-scraper scrape [--export] [--site=<slug>]
export
- Exports to a csv file, if possible, relative to the current directory.site
- Use any site in a multi-site environment, like if you have a sub-site called favorite-dogs
it would be --site=favorite-dogs
( A wp-cli plugin by Jay Wood )