Change domain from temporary

Viewing 3 posts - 1 through 3 (of 3 total)
#118596

Theron Brayman
Participant

We recently completed a new website using a temporary domain, with the Download Manager Free plugin. After changing the site’s domain to the “real” URL, the files in Download Manager still show the temporary domain. How can I update this? Thanks!

#118602

Nayeem Riddhi
Moderator

If you do not delete or destroy your database, after deleting or uninstalling the plugin, The data of files will still remain.

#118604

Shafayet
Moderator

@theronb49, if you attach a file as URL or with a full server path, the full URL will be attached and saved in the database, in such case, you may have to update path manually using some custom code after you move the site. Run the following code for once:

<?php
global $wpdb;
$files = $wpdb->get_results( "select * from {$wpdb->prefix}postmeta where meta_name = '__wpdm_files'" );
foreach ( $files as $file ) {
	$value = maybe_unserialize( $file->meta_value );
	foreach ( $value as $fileid ► $v ) {
		$value[ $fileid ] = str_replace( __OLDPATH__, __NEWPATH__, $v );
	}
	update_post_meta( $file->post_id, '__wpdm_files', $value );
}

?>

You must replace __OLDPATH__ with your old server path and __NEWPATH__ with your new server path.

Always keep a backup of your database befoer doing that
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Change domain from temporary’ is closed to new replies.