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.
- Download or clone the repository to
wp-content/mu-plugins/jw-wpcli-shortcode-scraper/
( Name is up to you ) - Create a new file in
wp-content/mu-plugins
call it whatever you want, I useinit.php
- Require the file like so:
<?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 calledfavorite-dogs
it would be--site=favorite-dogs
( A wp-cli plugin by Jay Wood )