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 | |
/** | |
* Only use bylines with posts. | |
* | |
* @see https://bylines.io/docs/customize-post-types/ | |
*/ | |
add_filter( 'bylines_post_types', function() { | |
return array( 'post' ); | |
}); |
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 | |
/** | |
* Thrash APCu until it can no longer allocate memory | |
*/ | |
header("Cache-Control: no-cache, no-store, must-revalidate"); | |
header("Pragma: no-cache"); | |
header("Expires: 0"); |
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 | |
/** | |
* Check that the WordPress install is still hosted at its internal domain. | |
* | |
* Run with `wp --require=host-check.php host-check --path=<path-to-wp>` | |
* | |
* Disables WP cron to prevent 'wp_version_check' from being run. | |
* | |
* @when before_wp_load |
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 | |
global $start_time; | |
function log_message( $message ) { | |
global $start_time; | |
$elapsed_time = microtime( true ) - $start_time; | |
WP_CLI::log( sprintf( '[%s] %s', format_log_timestamp( $elapsed_time ), $message ) ); | |
} |
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
aliases.feature:29 | |
cache.feature:18 | |
cap.feature:8 | |
cli-bash-completion.feature:23 | |
cli-info.feature:4 | |
cli.feature:15 | |
command.feature:44 | |
comment-generate.feature:5 | |
comment-list.feature:5 | |
comment-meta.feature:10 |
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 | |
if ( class_exists( 'WP_CLI' ) ) { | |
/** | |
* Fetch a post from WordPress.com and insert into the database. | |
* | |
* <site> | |
* : Site URL to download from. | |
* | |
* <slug> |
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 a 'Add rel="nofollow" to link' checkbox to the WordPress link editor | |
* | |
* @see https://danielbachhuber.com/tip/rel-nofollow-link-modal/ | |
*/ | |
add_action( 'after_wp_tiny_mce', function(){ | |
?> | |
<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 | |
add_filter( 'wp_login_errors', function( $errors ){ | |
$GLOBALS['hb_backup_user_login'] = null; | |
if ( ! empty( $GLOBALS['user_login'] ) && empty( $_POST['log'] ) ) { | |
$GLOBALS['hb_backup_user_login'] = $GLOBALS['user_login']; | |
$GLOBALS['user_login'] = wp_get_current_user()->user_email; | |
} | |
return $errors; | |
}); |
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
.widget-title h3:before, | |
.menu.ui-sortable .item-title:before { | |
content: "↕"; | |
font-size: 1.4em; | |
vertical-align: middle; | |
margin-right: 4px; | |
color: #989898; | |
} |
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_filter( 'register_post_type_args', function( $args, $post_type ) { | |
global $wp_rewrite; | |
if ( 'post' === $post_type && ! is_null( $wp_rewrite ) ) { | |
$archive_slug = 'blog'; | |
// Setting 'has_archive' ensures get_post_type_archive_template() returns an archive.php template. | |
$args['has_archive'] = $archive_slug; | |
// We have to register rewrite rules, because WordPress won't do it for us unless $args['rewrite'] is true. | |
$archive_slug = $wp_rewrite->root . $archive_slug; |