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 $wpdb; | |
$wpdb->insert( | |
$wpdb->postmeta, | |
array( | |
'post_id' => get_the_ID(), | |
'meta_key' => 'name', | |
'meta_value' => 'John' | |
), |
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 $wpdb; | |
$wpdb->update( | |
$wpdb->posts, | |
array( 'post_type' => 'new' ), | |
array( 'post_type' => 'old' ), | |
array( '%s' ), | |
array( '%s' ) | |
); |
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 $wpdb; | |
$wpdb->delete( $wpdb->postmeta, array( 'meta_id' => 101 ), array( '%d' ) ); |
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
<h1><?php esc_html_e( 'Blog', 'textdomain' ); ?></h1> |
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 | |
$volume_level = absint( $_POST['volume_level'] ); | |
update_post_meta( get_the_ID(), 'volume_level', $volume_level ); |
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 | |
$post = get_post(); | |
if ( current_user_can( 'edit_post_meta', $post->ID, '_email' ) && is_email( $_POST['email'] ) ) { | |
update_post_meta( $post->ID, '_email', $_POST['email'] ); | |
} |
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 ( wp_verify_nonce( $_POST['nonce'], 'update_email' ) && is_email( $_POST['email'] ) ) { | |
update_post_meta( get_the_ID(), 'email', sanitize_email( $_POST['email'] ) ); | |
} |
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
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"> | |
<?php the_title(); ?> | |
</a> |
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( | |
"sanitize_option_{$option_name}", | |
function ( $option_value, $option_name ) { | |
return filter_var( $option_value, FILTER_VALIDATE_BOOLEAN ); | |
}, | |
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 | |
/** | |
* Class Query_Arg_Alias | |
*/ | |
class Query_Arg_Alias { | |
/** | |
* Query var | |
* |