Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Changing postmeta fields programmatically
<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
}
@ashfame

This comment has been minimized.

Copy link
Owner Author

commented Jan 24, 2012

This file goes into the root of a WP install, and then ran by accessing the file through a browser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.