Skip to content

Instantly share code, notes, and snippets.

@designbuildtest
Created February 20, 2015 22:53
Show Gist options
  • Select an option

  • Save designbuildtest/cab0678b67c4a6711f6e to your computer and use it in GitHub Desktop.

Select an option

Save designbuildtest/cab0678b67c4a6711f6e to your computer and use it in GitHub Desktop.
Remove %20 from filenames
// http://webdevstudios.com/2015/02/19/10-things-i-learned-migrating-websites-to-wordpress/
// In your function where you save the original url, sanitize the filename before you store it
$cleaned_image_filename = santize_file_name( $image_filename );
update_post_meta( $post_id, ‘_orig_url’, $cleaned_image_filename );
// In the wds_redirect_old_traffic function update line 9
$request = santize_file_name( $wp->request );
// In the wds_get_post_id_from_external_url function update the following on line 35
$args = array(
'post_type' => ‘any',
'posts_per_page' => 1,
'post_status' => 'publish',
'meta_query' => array(
array(
'key' => '_orig_url',
'value' => $url,
'compare' => 'LIKE'
)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment