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 | |
/** | |
* Get the query variable even if the server rewrite rules do not support it. | |
* This is a workaround for the issue where the query vars are not set in the globals. | |
* | |
* @global WP_Query $wp_query WordPress Query object. | |
* | |
* @param string $query_var The variable key to retrieve. | |
* @param mixed $default_value Optional. Value to return if the query variable is not set. | |
* Default empty string. |
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_head', 'metaboxScripts'); | |
function metaboxScripts() { | |
global $current_screen; | |
if ('page' != $current_screen->id) return; | |
echo <<<HTML | |
<script type="text/javascript"> |
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 | |
// Put this in functions.php | |
add_action( 'template_redirect', function() { | |
if( is_home() or is_front_page() ) { | |
$url = esc_url(home_url( '/shop/')); | |
wp_redirect($url); | |
exit(); | |
} | |
}); |
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 edit_all_users($atts) { | |
global $wpdb; | |
$output = '<ol>'; | |
foreach( get_users() as $user ) { | |
$username = get_user_by( 'id', $user->ID )->user_login; | |
$email = get_user_by( 'id', $user->ID )->user_email; | |
$pos = strpos($username, '@'); | |
if ($pos !== false) { |