This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Run with: wp eval-file cmd-list.php --skip-wordpress | pbcopy | |
*/ | |
$ret = WP_CLI::launch_self( 'cli cmd-dump', array(), array( 'format' => 'json' ), true, true ); | |
$cmds = json_decode( $ret->stdout, true ); | |
$cmd_list = array(); | |
foreach( $cmds['subcommands'] as $cmd ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Run with wp --require=install-required-plugins.php theme activate p2 | |
*/ | |
WP_CLI::add_hook( 'after_wp_load', function() { | |
add_action( 'switch_theme', function( $_, $theme ){ | |
if ( 'p2' !== $theme->get_stylesheet() ) { | |
return; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Requires WP-CLI v0.24.0-alpha or later because it needs https://github.com/wp-cli/wp-cli/pull/2647 | |
*/ | |
if ( defined( 'WP_CLI' ) && WP_CLI ) { | |
WP_CLI::add_hook( 'after_invoke:site empty', function(){ | |
global $wpdb; | |
foreach( array( 'p2p', 'p2pmeta' ) as $table ) { | |
$table = $wpdb->$table; | |
$wpdb->query( "TRUNCATE $table" ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Run with `wp --require=import-cache.php import ... | |
*/ | |
WP_CLI::add_hook( 'after_wp_load', function(){ | |
// Only intercept HTTP requests when the importer is running | |
if ( ! defined( 'WP_IMPORTING') || ! WP_IMPORTING ) { | |
return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace LitART\LMS\REST; | |
use LitART\LMS\Query; | |
use WP_Error; | |
use WP_REST_Server; | |
class Records_Controller extends Posts_Controller { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get all of the public, protected, and private methods on WP-API classes | |
* | |
* Run with `wp eval-file class-methods.php` | |
*/ | |
foreach( get_declared_classes() as $class ) { | |
if ( ! preg_match( '#WP_REST_([A-Za-z_]+)?Controller#', $class ) ) { | |
continue; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'init', function(){ | |
// Replace '901bcc678021c0e12f1583085cafda1d' with a secret of your own. | |
if ( ! empty( $_GET['purge-cache'] ) && '901bcc678021c0e12f1583085cafda1d' === $_GET['purge-cache'] ) { | |
WpeCommon::purge_varnish_cache_all(); | |
echo 'Cache purged'; | |
exit; | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
/** | |
* Create a new MediaLibraryTaxonomyFilter we later will instantiate | |
*/ | |
var MediaLibraryTaxonomyFilter = wp.media.view.AttachmentFilters.extend({ | |
id: 'media-attachment-taxonomy-filter', | |
createFilters: function() { | |
var filters = {}; | |
// Formats the 'terms' we've included via wp_localize_script() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* List callbacks registered to a given action or filter. | |
* | |
* <hook> | |
* : The key for the action or filter. | |
* | |
* [--format=<format>] | |
* : List callbacks as a table, JSON, or CSV. Default: table. | |
* |