Created
February 20, 2015 22:53
-
-
Save designbuildtest/cab0678b67c4a6711f6e to your computer and use it in GitHub Desktop.
Remove %20 from filenames
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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