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 | |
/** | |
* Debugging WordPress things. | |
* | |
* All of this belongs in your wp-config.php file. | |
* | |
* This will make sure that the code you release is, at a minimum, | |
* relatively free of PHP notices and warnings. | |
* | |
* - WP_DEBUG: This turns on debugging mode. |
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 ( 'authenticate', 'rkv_login_options', 20, 3 ); | |
function rkv_login_options( $user, $username, $password ) { | |
if ( is_email( $username ) ) { | |
$user = get_user_by( 'email', $username ); | |
} | |
if ( $user ) { |
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 if the currently logged in WordPress user is an affiliate | |
if ( affwp_is_affiliate() ) { | |
// Do something | |
} |
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 | |
/** | |
* Rename meta keys | |
* Usage: update_meta_key( 'old_key', 'new_key'); | |
*/ | |
function update_meta_key( $old_key=null, $new_key=null ){ | |
global $wpdb; | |
$query = "UPDATE ".$wpdb->prefix."postmeta SET meta_key = '".$new_key."' WHERE meta_key = '".$old_key."'"; |