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 | |
$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
<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 | |
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
<?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->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; | |
$post = get_post(); | |
$query = $wpdb->prepare( | |
"SELECT * FROM {$wpdb->posts} WHERE post_type LIKE %s", | |
'%' . like_escape( $post->post_type ) . '%' | |
); | |
$results = $wpdb->get_results( $query ); |
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; | |
$query = $wpdb->prepare( | |
"SELECT * FROM {$wpdb->posts} WHERE post_type = %s", | |
$post->post_type | |
); | |
$results = $wpdb->get_results( $query ); |
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
<script> | |
var name = '<?php echo esc_js( $_POST['name'] ); ?>'; | |
</script> | |
<a href="<?php echo esc_url( home_url( '/blog/' ) ); ?>" | |
onclick="<?php echo esc_js( 'alert("Welcome " + name);' ); ?>"> | |
<?php _e( 'Blog', 'textdomain' ) ?> | |
</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
<label> | |
<span><?php _e( 'Label', 'textdomain' ); ?></span> | |
<textarea name="message"><?php echo esc_textarea( $_POST['message'] ); ?></textarea> | |
</label> |