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 | |
/** | |
* Permit anyone to post HTML in the comments | |
* Because ThunderP2 is only accessible by qualified users, | |
* this is just fine. | |
*/ | |
add_action( 'init', function() { | |
remove_filter( 'pre_comment_content', 'wp_filter_kses' ); | |
add_filter( 'pre_comment_content', 'wp_filter_post_kses' ); |
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 | |
/** | |
* Fix network admin URL to include the "/wp/" base | |
* | |
* @see https://core.trac.wordpress.org/ticket/23221 | |
*/ | |
add_filter( 'network_site_url', function( $url, $path, $scheme ){ | |
$urls_to_fix = array( | |
'/wp-admin/network/', |
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 editorial comments to the Edit Comments list view | |
*/ | |
add_filter( 'comments_clauses', 'efx_add_editorial_comments' ); | |
function efx_add_editorial_comments( $clauses ) { | |
global $pagenow; | |
if ( 'edit-comments.php' != $pagenow ) { | |
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 | |
/** | |
* How to integrate WordPress Core updates with your custom Plugin or Theme | |
* | |
* Filter the `update_plugins` transient to report your plugin as out of date. | |
* Themes have a similar transient you can filter. | |
*/ | |
add_filter( 'site_transient_update_plugins', 'wprp_extend_filter_update_plugins' ); | |
add_filter( 'transient_update_plugins', 'wprp_extend_filter_update_plugins' ); | |
function wprp_extend_filter_update_plugins( $update_plugins ) { |
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 | |
/** | |
* Include posts from authors in the search results where | |
* either their display name or user login matches the query string | |
* | |
* @author danielbachhuber | |
*/ | |
add_filter( 'posts_search', 'db_filter_authors_search' ); | |
function db_filter_authors_search( $posts_search ) { |
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 | |
/** | |
* Remove the ID tag from stylesheets so Google Pagespeed can do | |
* its thang | |
*/ | |
add_filter( 'style_loader_tag', function( $tag, $handle ) { | |
return str_replace( "id='$handle-css' ", "", $tag ); | |
}, 10, 2 ); | |
/** |
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 | |
/** Automatically append mtime to script and style versions for cache-busting action **/ | |
add_action( 'wp_enqueue_scripts', function() { | |
global $wp_styles, $wp_scripts; | |
foreach( array( 'wp_styles', 'wp_scripts' ) as $resource ) { | |
foreach( $$resource->registered as $name => $registered_resource ) { | |
// Not hosted here |
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 | |
/** | |
* Auto-paginate after 500 words | |
*/ | |
add_action( 'loop_start', function( $query ) { | |
if ( ! is_single() || 'post' != get_post_type() || ! $query->is_main_query() ) | |
return; | |
$content = $query->posts[0]->post_content; |
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( 'admin_bar_menu', function( $wp_admin_bar ){ | |
$args = array( | |
'id' => 'your-logo', | |
'title' => '<img style="padding-top:5px;" src="' . plugins_url( 'img/your-logo.png', __FILE__ ) . '" />', | |
); | |
$wp_admin_bar->add_node( $args ); | |
}, 0 ); | |
add_action( 'admin_bar_menu', function( $wp_admin_bar ){ | |
$wp_admin_bar->remove_node( 'wp-logo' ); |
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 | |
// 'page' sets the page number | |
add_filter( 'posts_where', function( $where, $query ) { | |
if ( ! empty( $_GET['page'] ) ) | |
$page = (int)$_GET['page']; | |
else | |
$page = 1; | |
$query->set( 'nopaging', false ); |