Created
January 24, 2012 08:00
-
-
Save ashfame/1668764 to your computer and use it in GitHub Desktop.
Changing postmeta fields programmatically
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
<pre><?php | |
require 'wp-load.php'; | |
$postmeta_field_name = 'video_url'; // fill it | |
echo $query = "SELECT * FROM {$wpdb->postmeta} WHERE meta_key = '$postmeta_field_name';"; | |
$data = $wpdb->get_results( $query ); | |
print_r( $data ); | |
foreach ( $data as $row ) { | |
$row['meta_value'] = new_url_api( $row['meta_value'] ); | |
// update query here | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This file goes into the root of a WP install, and then ran by accessing the file through a browser