Skip to content

Instantly share code, notes, and snippets.

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

This comment has been minimized.

Copy link
Owner Author

@ashfame ashfame 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.