Change domain from temporary

in Download Manager Free

Viewing 3 posts - 1 through 3 (of 3 total)
Jan 20, 2020 at 8:39 am
#118596
Participant
Theron Brayman
OP

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!

Jan 20, 2020 at 9:19 am
#118602
Moderator
Nayeem Riddhi
Staff

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

Jan 20, 2020 at 11:29 am
#118604
Moderator
Shafayet
Staff

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