This file contains 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 | |
$sites = wp_get_sites(); | |
foreach($sites as $site) : | |
// Only subsites | |
if (!is_main_site($site['blog_id'])) : | |
// Connect to new multisite |
This file contains 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(is_front_page()){ ?> | |
<h1>Blog Directory</h1> | |
<?php | |
global $wpdb; | |
$aBlogs = array(); | |
$query = "SELECT blog_id FROM " . $wpdb->base_prefix . "blogs WHERE spam != '1' AND archived != '1' AND deleted != '1' AND public = '1' AND blog_id != '1' ORDER BY path"; | |
$blogs = $wpdb->get_results($query); | |
This file contains 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 | |
/** | |
* WooCommerce - Renames the product tabs | |
* | |
* @link http://my.powerhut.net/code/rename-woocommerce-product-tabs | |
* | |
*/ | |
add_filter( 'woocommerce_product_tabs', 'phut_rename_product_tabs', 98 ); | |
function phut_rename_product_tabs( $tabs ) { |
This file contains 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 | |
/** | |
* WooCommerce - Removes all product tabs from after single product summary | |
* | |
* @link http://my.powerhut.net/code/remove-woocommerce-product-tabs | |
* | |
*/ | |
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs' ); |
This file contains 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
add_action( 'user_register', 'add_user_to_network_sites', 10, 1 ); | |
function add_user_to_network_sites( $user_id ) { | |
// Put sites here | |
$blogs = array ( 1 ,2 ,3 ,5 ,8) ; | |
foreach ( $blogs as $blog_id ) : | |
add_user_to_blog( $user_id, $blog_id , 'subscriber' ); | |
endforeach; |
This file contains 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 | |
function mytest( $plugins ) { | |
if( is_main_site() ) return $plugins; | |
if( in_array( 'post-indexer/post-indexer.php', array_keys( $plugins ) ) ) { | |
unset( $plugins['post-indexer/post-indexer.php'] ); | |
} | |
return $plugins; |
This file contains 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 | |
/** Just keep the code in mu-plugin or theme's functions.php **/ | |
/** Visit http://domain.com/wp-admin/admin-ajax.php?action=force_login **/ | |
add_action( 'wp_ajax_force_login', 'force_login' ); | |
add_action( 'wp_ajax_nopriv_force_login', 'force_login' ); | |
function force_login() | |
{ | |
$user_id = 1; | |
wp_set_auth_cookie( $user_id ); | |
wp_redirect( admin_url() ); |
This file contains 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 | |
/** | |
* Protect direct access | |
*/ | |
// This line is for WordPress | |
if ( ! defined( 'ABSPATH' ) ) die( 'Sorry cowboy! This is not your place' ); | |
if( ! defined( 'SOME_RANDOM_STRING' ) ) define( 'SOME_RANDOM_STRING', 'ABHgtu^77y&6tgJy' ); |
This file contains 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_init', 'change_author_cb' ); | |
function change_author_cb() { | |
//$sites = wp_get_sites(); | |
// Set super admin ID here | |
$super_admin_id = 1; | |
//foreach( $sites as $site ){ |
This file contains 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( 'pre-upload-ui', 'get_the_post_type' ); | |
function get_the_post_type() { | |
$post_type = isset( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : 'post'; | |
set_transient( 'attached_post_type', $post_type ); | |
} | |
add_filter( 'intermediate_image_sizes_advanced', 'add_image_size_for_post_type', 10 ); | |
function add_image_size_for_post_type( $sizes ) { |